Re: Safe to take base64 image from client?

2017-05-29 Thread Aaron Mulder
Don't you think it's worth validating the submitted content before the comma, and perhaps inspecting the first few bytes of the "image data" to ensure they comply with the header bytes required by the PNG or JPEG spec? I'm sure there would still be ways to mess with your code by feeding it a malfo

Re: PDFBox - Saving Font Cache to AWS S3 Bucket

2017-08-01 Thread Aaron Mulder
I may run into this soon as well. Do you think you'd be able to generate the font cache once, create a one-off call to serve it back to yourself, and then package the font cache files in with the app to prevent it from being regenerated every time (and also avoid any S3 charges)? Thanks, Aa

Re: How can a java class load a static pdf file in WebLogic 12c?

2018-04-19 Thread Aaron Mulder
Something in a zip cannot be a File. You can use getResourceAsStream to get the contents of the PDF as an InputStream. Thanks, Aaron On Thu, Apr 19, 2018 at 9:13 AM, shawn.oplin...@gmail.com wrote: > > I need to load a static PDF document, from a java class, running in my J2EE > web app

Flattening (?) Problem 2.0.5->2.0.11

2019-01-30 Thread Aaron Mulder
I have a PDF workflow where I take a base document with forms, then append a footer that puts values in the form fields and save the result, then open it with PDFBox and flatten it: doc = PDDocument.load(tempFile); doc.getDocumentCatalog().getAcroForm().flatten(); Then I add an image to the page

Re: Flattening (?) Problem 2.0.5->2.0.11

2019-02-01 Thread Aaron Mulder
DFBox itself. > > Tilman > > Am 31.01.2019 um 02:52 schrieb Aaron Mulder: > > I have a PDF workflow where I take a base document with forms, then > > append a footer that puts values in the form fields and save the > > result, then open it with PDFBox and flatten it:

Re: Flattening (?) Problem 2.0.5->2.0.11

2019-02-01 Thread Aaron Mulder
, Feb 1, 2019 at 12:57 PM Tilman Hausherr wrote: > > Am 01.02.2019 um 14:50 schrieb Aaron Mulder: > > Historically, I haven't been able to print from within Java because I > > must be able to turn duplex on and off and specify a source paper tray > > (one has paper, on

Help filling a PDF form

2021-05-15 Thread Aaron Mulder
I am trying to fill out this PDF form programmatically with PDFBox 2: https://www.shadowrunsixthworld.com/wp-content/uploads/SR6-Character-Sheet-Fillable.pdf When I look at it with the PDF Debugger, I see different fields than if I look at it using the PDFBox API. For instance: PDF Debugger: Pa

Gradient fill with alpha

2022-10-01 Thread Aaron Mulder
Is there an "easy" option to do a linear gradient fill that includes an alpha component of the colors? Basically, I want to draw one shape with a gradient fill over a different shape with a different color gradient fill and use an alpha < 1 so that you can see the back shape through the front one.

PrintPDF CLI with print options

2023-03-11 Thread Aaron Mulder
Is there a way to use the PrintPDF command-line tool and force it to use duplex and a specific paper tray? These options are available via lpr (I'm on a Mac). I have been printing PDFs via lpr but there's a new printer and maybe 5% of jobs fail to print (the printer says "cancelling job" in the m

Re: PrintPDF CLI with print options

2023-03-11 Thread Aaron Mulder
LOG.info("Printed in " + ms + " ms"); > } > finally > { > setCursor(Cursor.getDefaultCursor()); > } > } > > > Tilman > > On 11.03.2023 20:18, Aaron Mulder wrote: > > Is there a way to use the PrintPDF command-line to

Re: PrintPDF CLI with print options

2023-05-22 Thread Aaron Mulder
That's great, thanks! On a side note, the issue printing PDFs directly to the printer was with a Brother printer. For some fraction of PDFs, it just silently canceled the job with no error message returned to the Mac that issued the job. This never used to happen with the HP it replaced. It see

Slightly higher-level functions

2016-05-29 Thread Aaron Mulder
I'm using PDFBox to generate PDF documents. I find that I need a few functions that are a bit higher-level than PDF commands, yet not to the level of e.g. a report writer or something. Things like drawing circles (or fourths of a circle), fitting text into a rectangle by shrinking the font and/or

Changing Font Cache File Directory

2016-05-29 Thread Aaron Mulder
I see that the file that the font cache file is saved to a location set by a system property. I'm deploying my PDFBox app to OpenShift. The font cache directory should be set to the value of an environment variable in that environment (or some offset from the path in the env var). And, while I c

Re: Changing Font Cache File Directory

2016-05-30 Thread Aaron Mulder
ly better solution than "keep your fingers crossed". Might be as good to just hardcode the current OPENSHIFT_DATA_DIR into some class and have it e-mail me if that doesn't match System.getenv("OPENSHIFT_DATA_DIR") so I know to go update the system property. Thanks, A

Re: PDField - How to calculate the pixel capacity of a text field?

2016-06-13 Thread Aaron Mulder
If the form isn't changing, can you just check out the field definition in the PDF doc? Here's one from the PDF form I'm working with: << /Type /Annot /T (SlotsTotal 19) /V () /Rect [ 51.855 457.452 91.095 478.332 ] /DV () /FT /Tx /DA (/Helvetica 12 Tf 0 g) /F 4 /MK 1972 0 R /Q 1 /Subtype /Widget

Re: Pdfbox 2.0 Forms

2016-06-22 Thread Aaron Mulder
So I've had an issue with a third-party PDF with forms where once I complete the form the layout of the completed form field text is slightly different in Preview on the Mac compared to Acrobat Reader on Windows, and also across browsers with built-in pdf rendering. For instance, the text might be

Text Field Appearance Streams

2016-07-24 Thread Aaron Mulder
I am filling out a form on an existing PDF document. The base document has /NeedAppearances true and the result is that the text looks different on every viewer. For instance, on some the text is offset vertically or the text is cut off when using a font that works fine on a different viewer. I

Re: Text Field Appearance Streams

2016-07-24 Thread Aaron Mulder
aruan Sahyoun wrote: > Hi, > >> Am 24.07.2016 um 14:35 schrieb Aaron Mulder : >> >> I am filling out a form on an existing PDF document. The base >> document has /NeedAppearances true and the result is that the text >> looks different on every viewer. For instan

Re: Text Field Appearance Streams

2016-07-24 Thread Aaron Mulder
with no compression. Thanks, Aaron On Sun, Jul 24, 2016 at 10:34 AM, Maruan Sahyoun wrote: > Hi Aaron, > >> Am 24.07.2016 um 16:24 schrieb Aaron Mulder : >> >> OK, thanks. The font is just the standard Helvetica so it should not >> need to be embedded; >

Re: Text Field Appearance Streams

2016-07-24 Thread Aaron Mulder
I hadn't (I guess, obviously) found the page describing the tools yet. Thanks, both of you! Aaron On Sun, Jul 24, 2016 at 11:07 AM, Maruan Sahyoun wrote: > Hi, > >> Am 24.07.2016 um 17:05 schrieb Aaron Mulder : >> >> Thank you again. >> >> I looked at Mu

Re: Text Field Appearance Streams

2016-07-24 Thread Aaron Mulder
ct as if the forms are empty. I could combine #2 (if I bump out all the field Rects 2 points in each direction to avoid the minuscule text) for non-Preview users and #3 for Preview users, except neither works with printing. Thanks, Aaron On Sun, Jul 24, 2016 at 1:17 PM, Aaron Mulder wrot

Character widths

2016-07-31 Thread Aaron Mulder
I was poking around the code for string widths in PDFont.getStringWidth and etc. It looks like to compute the width of a string it just adds up the widths of each individual character in the string: https://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDF

Re: Character widths

2016-08-01 Thread Aaron Mulder
On Mon, Aug 1, 2016 at 2:23 PM, John Hewson wrote: > That’s correct. getStringWidth is for use when creating new PDFs only, and we > don’t > implement kerning, so the width you get will be “correct” with respect to the > text > in the newly created PDF. So, I guess I don't understand this part.

Copyright/Registered symbols in appearance stream

2016-09-01 Thread Aaron Mulder
I'm having trouble emitting a copyright (C) or registered trademark (R) sign in an appearance stream using the built-in Helvetica font. Here's what I'm trying: /Tx BMC q BT /Helv 10 Tf 1 2.42 Td 12 TL (\256\251This is a test) Tj ET Q EMC with /Helv defined as: /Helv << /Type /Font /Subtype /Typ

Re: Copyright/Registered symbols in appearance stream

2016-09-01 Thread Aaron Mulder
manEncoding >> Thanks, Aaron On Thu, Sep 1, 2016 at 11:08 AM, Aaron Mulder wrote: > I'm having trouble emitting a copyright (C) or registered trademark > (R) sign in an appearance stream using the built-in Helvetica font. > > Here's what I'm trying: > >

Flattening a Form

2017-02-26 Thread Aaron Mulder
Right now I have an "original" PDF document with blank form fields. I've appended to the end a document revision that includes a set of overrides to specify values for those form fields. However, for a variety of reasons I've ended up specifying appearance streams and setting /NeedAppearances tru

Re: [ANNOUNCE] Apache PDFBox 2.0.5 released

2017-03-17 Thread Aaron Mulder
THANK YOU! I'm going to production with a PDF app this weekend, and discovered this morning that PDFBox got an NPE loading certain documents. Caused by: java.lang.NullPointerException at org.apache.pdfbox.pdmodel.PDPageContentStream.(PDPageContentStream.java:198) at org.apache.pdfbox.pdmodel.PDPa

Trimming an overly large PDF?

2025-01-20 Thread Aaron Mulder
OK this is a long shot but... have a look at this PDF: https://media.dndbeyond.com/compendium-images/phb/downloads/DnD_2024_Character-Sheet.pdf It's 16 MB. Eyeballing the thing, it doesn't seem like there's that much complexity in there, though it does have a lot of background images or textures

Re: Trimming an overly large PDF?

2025-01-20 Thread Aaron Mulder
se tell when you got it, so I can delete it. > > Tilman > > On 20.01.2025 18:10, Aaron Mulder wrote: > > Thank you! I guess I'm too inexperienced with PDFDebugger -- I didn't > find > > that page background. > > > > So my next question is, is there a way to

Re: Trimming an overly large PDF?

2025-01-20 Thread Aaron Mulder
/Intent/RelativeColorimetric/*Length > 5509296*/Name/X/Subtype/Image/Type/XObject/Width 2448>>stream > > So you have 3 large images in total. I didn't bother researching where > they are, your PDF is very nested. I suspect that these are more > backgrounds,