Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

PdfFileMend addText not working

$
0
0
The following code (a modified sample) does not add the added text.  Also when used with addImage() the images do not display.  Removing the addText() the images display properly.

public class InsertEmptyPageAtEndofPDFFile
{
    public static void main(String[] args) throws Exception
    {
        // The path to the documents directory.
        String dataDir = "src/programmersguide/workingwithasposepdf/workingwithpages/insertemptypageatendofpdffile/data/";

        //open first document
        com.aspose.pdf.Document pdfDocument1 = new com.aspose.pdf.Document(dataDir + "input.pdf");

        //insert a empty page in a PDF
        pdfDocument1.getPages().add();
        PdfFileMend mender = new PdfFileMend();
        mender.bindPdf(pdfDocument1);
//        mender.setWordWrap(true);
//        mender.setWrapMode(WordWrapMode.ByWords);
        
//        FormattedText text = new FormattedText("This is some text",
//               java.awt.Color.BLACK, java.awt.Color.WHITE,
//               FontStyle.Courier, EncodingType.Winansi, true, 14 );
//        mender.addText(text, 1,
//                100, 200, 200, 400);
        mender.addText(new FormattedText("This is some text"), 1,
                100, 200, 200, 400);

        //save output file
        pdfDocument1.save(dataDir + "output.pdf");

        System.out.println("Empty page added successfully!");
    }
}



Viewing all articles
Browse latest Browse all 3131

Trending Articles