I am using ZXing to put a data matrix on each page of a workflow of documents 
that I am sending to the mailroom like so:

  Given pdDocument, pdPage, String contents, size, x, y:

     BitMatrix bitMatrix = new DataMatrixWriter().encode(contents, 
BarcodeFormat.DATA_MATRIX, size, size);
     BufferedImage bufferedImage = 
MatrixToImageWriter.toBufferedImage(bitMatrix);
     PDImageXObject pdImageXObject = 
LosslessFactory.createFromImage(pdDocument, bufferedImage);
     PDPageContentStream pdPageContentStream = new 
PDPageContentStream(pdDocument, pdPage, true, false);
     pdPageContentStream.drawImage(pdImageXObject, x, y, size, size);
     IOUtils.closeQuietly(pdPageContentStream);
  
The data matrix needs to be sized and positioned with some precision on the 
printed page to support the mailroom sorting/enveloping process.
But so far I have trouble with that because:
 #1 - The source documents are of all inconsistent width/height on the page
 #2 - To deal with #1, the mailroom printer drivers all specify a "Fit" option 
which will shrink oversized pages and expand undersized pages.

Can anyone suggest a solution so that I can get the data matrix sized and 
positioned correctly regardless of the input size and "fitting"?
Using PDFBox-2.0.0-RC3.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to