Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Crop Boxes, XPdfForm, and XGraphics.DrawImage #54

Open
peter0302 opened this issue Apr 18, 2018 · 3 comments
Open

Issues with Crop Boxes, XPdfForm, and XGraphics.DrawImage #54

peter0302 opened this issue Apr 18, 2018 · 3 comments

Comments

@peter0302
Copy link

Resources

Issue Submission Code
PNM PDFSharp Issue Submission 2018-04-18.zip

Reporting an Issue Here

We have a PDF with a crop box that doesn't match the media box and we want to create a new PDF without any cropping but whose appearance matches the original when opened in Acrobat or any other reader.

Expected Behavior

Expected behavior is that

  • XPdfForm.PointWidth and XPdfForm.PointHeight should take the crop box into account
  • Calling XGraphics.DrawImage when the source image is an XPdfForm should take the crop box into account
  • Even if those functions don't take the crop box into account, I ought to be able to use the crop box as the srcRect for XGraphics.DrawImage

Actual Behavior

  • The source page always reports dimensions based on the media box and never the crop box
  • When I attempt to use the crop box as the srcRect for XGraphics.DrawImage, the image is squished.

Steps to Reproduce the Behavior

See issue submission template for code.

  • Use XPdfForm.FromStream to open the source PDF and then set the page index.
  • Create a new destination PDF and PDF page using the width and height of the source page's crop box
  • Use the XPdfForm object as the source image in a call to XGraphics.DrawImage
  • Use the source crop box dimensions as the srcRect

Note

I tried this with both the current stable version as well as the new version (PDFSharp-GDI), both from nuget. In the attached code, the WPF project is using the new PDFSharp-GDI. The other projects are using the current stable version. So this is still an issue in the current release candidate.

Thanks!

@peter0302
Copy link
Author

Hi just wondering if this is anything that's likely to be addressed in the new release. This is affecting a great number of our PDFs.

@TH-Soft
Copy link
Contributor

TH-Soft commented May 1, 2018

I can only speak for myself. Most likely I will not address this with the next NuGet release.
I want to release a new "stable" version before tackling bigger changes that could lead to new bugs.

@peter0302
Copy link
Author

peter0302 commented May 2, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants