pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Duane Nickull <du...@technoracle-systems.com>
Subject Re: Font being changed after form field is set
Date Fri, 05 Oct 2012 21:14:39 GMT
PDF's have embedded fonts and system fonts.  This is a complex topic (I used
to work at Adobe for 8 years).   It may be possible that the fonts are not
available although in this case, courier is very common so I cannot see the
issue.

I want to respect the list's policy on promoting commercial software but if
you want  to discuss offline, I am available.  Technoracle (my post- Adobe
company) is comprised of many ex-Adobe PDF experts and we have perfected
some solutions for rendering PDF forms on mobile.  Nevertheless, I am here
in this forum to share expertise when I can so I will focus on that first.

BTW the attachment never came through.  If you resend, I be more than happy
to help you for free as a community member.  Our emphasis is on mobile
anyways so 

Duane Nickull
***********************************
Technoracle Advanced Systems Inc.
Consulting and Contracting; Proven Results!
i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
b. http://technoracle.blogspot.com
t.  @duanechaos
"Don't fear the Graph!  Embrace Neo4J"



From:  Eugene Chang <EChang@bonafide.com>
Reply-To:  <users@pdfbox.apache.org>
Date:  Friday, 5 October, 2012 10:26 PM
To:  "users@pdfbox.apache.org" <users@pdfbox.apache.org>
Subject:  Font being changed after form field is set

Hi,
 
We have encounter a problem when using pdfbox.
 
We have a pdf form with fields and font set to Courier (please see attached
pdf file PRP.pdf).
 
After running the program below which tries to set the value of one of the
fields, font was being changed to Helvetica (please see attached pdf file
forms26916.pdf).
 
Is there any way we can set the values and retain the original font?
 
 
Regards,
 
 
Eugene
 
 
 
 
package lab;
 
import java.io.File;
 
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 
public class TestBed1 {
    public static void main(String[] args) {
        try {
            PDDocument pdfDocument = PDDocument.load("C:/Temp/pdf/PRP.pdf");
            PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
            PDAcroForm acroForm = docCatalog.getAcroForm();
            acroForm.getField("officeAfterHourAndTollFree").setValue(
                    "Phone: (805) 777-7666  Fax: (805) 777-9876");
            File file = File.createTempFile("forms", ".pdf");
            pdfDocument.save(file.getCanonicalPath());
            pdfDocument.close();
 
            System.out.println(file.getCanonicalPath());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message