Rank: Member
Groups: Registered
Joined: 8/11/2016(UTC) Posts: 14  Thanks: 1 times
|
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Maybe you need to call pdfViewer.ClearRenderBuffer()?
|
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 8/11/2016(UTC) Posts: 14  Thanks: 1 times
|
I added that as the last line but still nothing. I do see e.Page.PageObjects.Count increment after my image is added to the collection.
I also added this line:
e.Page.PageObjects[0].FillColor = Color.Red;
I see one of the text objects change to red.
Any other suggestions?
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
It is difficult to say something without seeing your code. I have checked the example from the link above. Everything works perfectly. Maybe you did not set up the transformation matrix? Or did not subscribe to pdfViewer1.DocumentLoaded event? Could you please create a simple msvc project with this issue and provide it to me?
|
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 8/11/2016(UTC) Posts: 14  Thanks: 1 times
|
wpf_sig.zip (848kb) downloaded 42 time(s).I've created a new WPF app. It has a pdfviewer and button on it plus the discussed code. But I can't get the project to start. When I add PdfCommon.Initialize() to the MainWindow.xaml.cs constructor, the app crashes on startup with this error: Quote:XamlParsedException occurred
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
The invocation of the constructor on type 'my_project.MainWindow that matches the specified binding constraints threw an exception. Line number 4 line position 9. Commenting out PdfCommon.Initialize() removes the error. Getting past that error is the first step then we can look at the remaining code. Project is attached. Edited by user Friday, August 12, 2016 9:25:41 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Firstly you have not properly configured project. You forgot to add the pdfium.dll files into it. Please find detailed instructions how to configure project here: https://pdfium.patagames.com/help/Secondly, you forgot to set the bitmap to the PdfImageObject. please look at following code Code:
PdfBitmap bmp = new PdfBitmap(200, 100, true);
bmp.FillRect(0, 0, 200, 100, System.Drawing.Color.Red);
var img = PdfImageObject.Create(e.Page.Document);
//--------------------- you should do this--------------------------------
img.SetBitmap(bmp);
//------------------------------------------------------------------------
img.SetMatrix(1, 0, 0, 1, 0, 0);
img.Transform(bmp.Width, 0, 0, bmp.Height, 0, 0);
e.Page.PageObjects.InsertObject(img);
pdfViewer1.UpdateLayout();
Edited by user Friday, August 12, 2016 8:22:16 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 8/11/2016(UTC) Posts: 14  Thanks: 1 times
|
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close