[ 
https://issues.apache.org/jira/browse/PDFBOX-3216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Hewson updated PDFBOX-3216:
--------------------------------
    Priority: Minor  (was: Blocker)

> Problems containing certain fonts
> ---------------------------------
>
>                 Key: PDFBOX-3216
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3216
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Writing
>    Affects Versions: 1.8.10
>         Environment: Windows 7, JAVA 1.7
>            Reporter: Sumit Jha
>            Priority: Minor
>
> We are trying to take a PDF file as input to a process, shrink the pages to 
> 90% of their original size, add a barcode at the top of each page, and then 
> create a new PDF file with the altered content.
> We tried using the PDFBOX version 1.8.10. Sample code is below:
> {code}
> package test;
> import java.awt.image.BufferedImage;
> import java.io.File;
> import java.io.FileInputStream;
> import java.util.List;
> import javax.imageio.ImageIO;
> import org.apache.pdfbox.pdmodel.PDDocument;
> import org.apache.pdfbox.pdmodel.PDPage;
> import org.apache.pdfbox.pdmodel.common.PDRectangle;
> import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
> import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg;
> import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage;
> public class TestPDFBox2 {
>       public TestPDFBox2() {
>               // TODO Auto-generated constructor stub
>       }
>       /**
>        * @param args
>        */
>       public static void main(String[] args) {
>               // TODO Auto-generated method stub
>               
>               try{
>                       
>                       File input = new 
> File("C:\\workspaceRAD85_PDFBox_POC\\607018.pdf"); 
>                       
>                       PDDocument pd = PDDocument.load(input);
>                       List pdAllPages = pd.getDocumentCatalog().getAllPages();
>                       
>                       PDPage page1 = (PDPage)pdAllPages.get(0);
>                       BufferedImage image1 = page1.convertToImage();
>                       ImageIO.write(image1, "jpg", new 
> File("C:\\workspaceRAD85_PDFBox_POC\\image_607018_11.jpg"));
>                       
>                       PDPage page2 = (PDPage)pdAllPages.get(1);
>                       BufferedImage image2 = page2.convertToImage();
>                       ImageIO.write(image2, "jpg", new 
> File("C:\\workspaceRAD85_PDFBox_POC\\image_607018_21.jpg"));
>                                               
>                       pd.close();
>                       
>                       PDDocument pdNew = new PDDocument();
>               
>                       PDPage pageNew = new PDPage();
>               pdNew.addPage(pageNew);
>               
>               PDXObjectImage image = null;
>               image = new PDJpeg(pdNew, new 
> FileInputStream("C:\\workspaceRAD85_PDFBox_POC\\image_607018_11.jpg"));
>               
>               PDPageContentStream content = new PDPageContentStream(pdNew, 
> pageNew);
>               //content.drawImage(image, 0, 0);
>               content.drawXObject(image, 0, 0, 600, 700);
>               content.close();
>               
>               PDPage pageNew2 = new PDPage();
>               pdNew.addPage(pageNew2);
>               
>               PDXObjectImage image0 = null;
>               image0 = new PDJpeg(pdNew, new 
> FileInputStream("C:\\workspaceRAD85_PDFBox_POC\\image_607018_21.jpg"));
>               
>               PDPageContentStream content0 = new PDPageContentStream(pdNew, 
> pageNew2);
>               //content.drawImage(image, 0, 0);
>               content0.drawXObject(image0, 0, 0, 600, 700);
>               content0.close();
>                       
>               
> pdNew.save("C:\\workspaceRAD85_PDFBox_POC\\Image_To_PDF_607018_1.pdf");
>               pdNew.close();
>               
>                
>                       
>                       /*PDRectangle rect = page1.getMediaBox();
>               float upperRightY = rect.getUpperRightY();
>               rect.setUpperRightY(upperRightY*(0.70f));
>               page1.setMediaBox(rect);
>               
>               pd.save("C:\\workspaceRAD85_PDFBox_POC\\shrink.pdf");*/
>               
>               
>                       
>                       
>               }catch (Exception e) {
>                       
>               }
>       }
> }
> {code}
> We are seeing that there are few problems while converting few PDFs:
> 1. In some source PDFs bullet point listed is changed to some different icon 
> in converted PDF.
> 2. In some PDFs when there is a bullet point in the source document the text 
> on the line following the bullet point is destroyed/missing characters.
> We’ve read some posts that we should try using the PDFBOX version 2.1.10, but 
> that is not an approved version at our company and it is not released too.    
> I should also note that the source PDF documents we are trying to add the Bar 
> Codes to are quite varied- they can come in any size, using any font, with 
> images, and be oriented portrait or landscape. The goal is to get these 
> printed on 8.5 by 11 inch paper with a barcode on them at top.
> Do you have any suggestions on how to proceed?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to