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

PDF to honor nearest-neighbor #405

Closed
tresf opened this issue Jan 25, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@tresf
Copy link
Contributor

commented Jan 25, 2019

Per PDFBOX-4435 rendering hints will be honored with the next release.

Quoting the bug report...

@tresf please test whether this solves the bad quality problems. What you should do is to pass these renderingHints to PDFPrintable:

RenderingHints r = new RenderingHints(null);
r.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); // maybe, maybe not
r.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); // don't know
r.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); // important

@tresf tresf added this to the 2.0.9 milestone Jan 25, 2019

@bberenz

This comment has been minimized.

Copy link
Member

commented Feb 21, 2019

Support for rendering hints with pdfs is added under the pdfhints branch for when they release the next version.

@klabarge

This comment has been minimized.

Copy link
Member

commented Mar 5, 2019

I tested and interpolation: nearest-neighbor is honored with PDF's. It was hard to tell when physically printed, however I printed to PDFCreator and zoomed in on the barcode

With Nearest Neighbor

image

Without Nearest Neighbor

image

@tresf

This comment has been minimized.

Copy link
Contributor Author

commented Mar 5, 2019

@klabarge thanks. I've added a feature that should turn off text aliasing when nearest-neighbor is provided as well.

@klabarge @lite1979 can you test on thermal paper and see what type of differences we get?

@klabarge

This comment has been minimized.

Copy link
Member

commented Mar 6, 2019

I've added a feature that should turn off text aliasing when nearest-neighbor is provided as well.

This works, I printed to PDFCreator and was able to zoom in on the text, and nearest-neighbor is clearly being honored.

I tested to thermal printers (Zebra LP2844 and an Epson EpsonTM-T88VI Receipt), using our demo PDF and the PDF provided in the PDFBOX report, and I am unable to detect a difference in the output with my eyes.

@tresf tresf closed this in #429 Mar 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.