pvginkel / PdfiumViewer

PDF viewer based on Google's PDFium.
Apache License 2.0
967 stars 418 forks source link

LoadJpegFile & InsertObject work on old build but not new #100

Open coderPureBasic opened 7 years ago

coderPureBasic commented 7 years ago

I can't be sure, but either one of these two functions is not working properly with the latest pdfium.dll build. The JPG image is loaded, inserted, and displayed properly with the older build (December 6 2015 - linked here: PdfiumViewer/Libraries/Pdfium/x86/, but not with the newer build (September 28 2016 - obtained via Git download).

  1. FPDFImageObj_LoadJpegFile
  2. FPDFPage_InsertObject

However, with both builds, all functions return success results. Tested on 64-bit versions of Windows 8.1 and Windows 10 through 32bit compiles. The execution order of the function set is as follows:

  1. FPDF_LoadDocument
  2. FPDF_LoadPage
  3. FPDFPageObj_NewImgeObj
  4. FPDFImageObj_LoadJpegFile
  5. FPDFPageObj_Transform
  6. FPDFPage_InsertObject
  7. FPDFPage_GenerateContent
  8. FPDF_RenderPage

Is this some known issue, and might there be some workaround for it?

Thank you.

Sofia I.

pvginkel commented 7 years ago

I prefer not to maintain these methods. Pdfium actually provides a lot of methods to modify PDF documents, but the PdfiumViewer project doesn't really work well with those. It assumes that the PDF file is static, so changes will not be properly displayed in the viewer.

If you need to modify PDF files, you're far better off using https://github.com/itext/itextsharp. Could you have a look at that project and see whether this is an option for you?