|
|
Excellent! Thanks.
|
|
|
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();
|
|
|
wpf_sig.zip (848kb) downloaded 41 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.
|
|
|
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?
|
|
|
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?
|
|
|
Maybe you need to call pdfViewer.ClearRenderBuffer()?
|
|
|
|
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