Hi,
We purchased Apose Barcode and PDF . We are using both products in java, we wrote restful services to add barcode images on pdf. one of our .Net applications consuming these restful services …
- Rest service accepts .pdf document and barcodeId and returns PDF as byte array with barcode on it.
- for the response .net application takes byte stream writes in to file
issue when we see the file its always truncating last digit in the text under the barcode . ( e.g : if barcode is 123456 , its showing as 12345.
Thanks,
Ramesh
@senthil125,
Please share a sample PDF file and the code snippet that you are using for the above described process. This information will help us to reproduce the issue at our end. Furthermore please update us about JDK version at your end.
Attached PDF. JSK Version we are using is : JDK1.8
Code
Document pdfDocument1 = null;
response = new BarcodeAPIResponse();
//Document pdfDocument1 = new Document(“input.pdf”);
// Set coordinates
// Get the page you want to add the image to
// Page page = pdfDocument1.getPages().get_Item(1); // used when actual pdf sending to Document
InputStream inputFileStream = new ByteArrayInputStream(request.getInputDocument());
pdfDocument1 = new Document(inputFileStream);
for( BarcodeMap barcodeMap : request.getBarcodeList() ){
BarCodeBuilder builder = new BarCodeBuilder();
builder.setSymbologyType(com.aspose.barcode.Symbology.Code93Extended);
builder.setCodeText(barcodeMap.getBarcodeId()+"");
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
builder.save(outStream, BarCodeImageFormat.Jpeg);
InputStream is1 = new ByteArrayInputStream(outStream.toByteArray());
ImageStamp imageStamp = new ImageStamp(is1);
imageStamp.setXIndent(barcodeMap.getXCoord());
imageStamp.setYIndent(barcodeMap.getYCoord());
imageStamp.setHeight(barcodeMap.getHeight());
imageStamp.setWidth(barcodeMap.getWidth());
imageStamp.setOpacity(1.0);
if(barcodeMap.getPageNoInPdf()>0){
Page page = pdfDocument1.getPages().get_Item(barcodeMap.getPageNoInPdf());
page.addStamp(imageStamp);
}else{
for (int pdfPage = 1; pdfPage <= pdfDocument1.getPages().size(); pdfPage++) {
Page page = pdfDocument1.getPages().get_Item(pdfPage);
page.addStamp(imageStamp);
}
}
}
// Save the new PDF
ByteArrayOutputStream output = new ByteArrayOutputStream();
pdfDocument1.save(output);
pdfDocument1.close();
// Close image stream
//is.close();
response.setStatusCode(BarcodeAPIConstants.WS_RESPONSE_SUCCESS_CODE);
response.setProcessedForm(output.toByteArray());
response.setOtherMessage("success");
return response;
Barcodes
First row from top:
9223372036854775804
9223372036854775803
Second row from top:
9223372036854775807
9223372036854775806
9223372036854775805
Coversheet2_WithBarcode_171120033450.pdf (276.5 KB)
@senthil125,
Thank you for details. We are working on this query. We will update you very soon about our findings.
This is only happening in Unix Environment.
@senthil125,
Thank you for your patience. We have investigated the issue at our end. We are unable to reproduce the said issue. The generated sample output PDFs are attached for your reference. Please share a complete sample project for further analysis along with input file. Also share details of your Unix environment.
generated_outputs.zip (371.9 KB)
Hi ,
Thanks for your response. May be we can’t share the project because of security concerns. But below is our UNIX environment details
Unix Version : RedHat Linux 6.0 ( RHEL 6 )
Jdk Version : JDK 1.8
Deployed on Tomcat 8.5
@senthil125,
Thank you for details. An investigation ticket has been logged into our system with ID BARCODEJAVA-410 for our Product team. We will update you here once there is some information or an update available in this regard.
@senthil125,
We have further investigated the issue. We have tested on Windows, Mac, and Ubuntu. No truncated text issue was found. Please try the latest version of Aspose.BarCode at your end and update us in case of any query or comments.