Hi,
> Am 11.03.2016 um 23:10 schrieb Ruggentaler, JR <[email protected]>:
>
> I was able to convert the PDF to a PDF form using Acrobat Pro. I filled in
> a few of the fields using PDFBox but the fonts in the fields varied. Some
> were huge and others were reasonable. I went back into Acrobat Pro and
> looked at the properties for the form fields and the font size is set to
> Auto. How do I set the font size on my input fields to all use the same
> fort and size?
>
using Adobe Acrobat you can set the font size in the fields property dialog or
using PDFBox you can change the default appearance string
PDField.getDefaultAppearance()
After the font resource name e.g. \Helv this will have '0' for auto sizing the
font. Replace that with the font size you need and put the string back in with
PDField.setDefaultAppearance().
BR
Maruan
> private void exportFDF(String[] args) throws IOException {
>
> PDDocument pdf = null;
> FDFDocument fdf = null;
> String inputFile = "./Resources/UCDavisRequest.pdf";
> String outputFile = "./Output/UCDavisRequest.pdf";
> Map<String, String> fieldMapping = new HashMap<String,
> String>();
> fieldMapping.put("PROVIDER NAME", "John J. Jingleheimer");
> fieldMapping.put("PROVIDER TAX ID Medicare ID", "12345");
> fieldMapping.put("PROVIDER ADDRESS", "123 Mockingbird Lane,
> Austin TX
> 78614");
> fieldMapping.put("MD", "");
> fieldMapping.put("Mental Health", "");
> fieldMapping.put("Hospital", "");
> fieldMapping.put("ASC", "");
> fieldMapping.put("SNF", "");
> fieldMapping.put("DME", "");
> fieldMapping.put("Rehab", "");
> fieldMapping.put("Home Health", "");
> fieldMapping.put("Ambulance", "");
> fieldMapping.put("Other", "");
> fieldMapping.put("please specify type of other", "");
> fieldMapping.put("Single", "");
> fieldMapping.put("Multiple LIKE Claims complete attached
> spreadsheet
> Number of claims", "");
> fieldMapping.put(" Patient Name", "Jane Doe");
> fieldMapping.put("Date of Birth", "09/28/1956");
> fieldMapping.put(" Health Plan ID Number", "A1234");
> fieldMapping.put("Patient Account Number", "98765");
> fieldMapping.put("Original Claim ID Number If multiple claims
> use
> attached spreadsheet", "");
> fieldMapping.put("Service FromTo Date Required for Claim
> Billing and
> Reimbursement Of Overpayment Disputes", "03/10/2016 - 03/10/2016");
> fieldMapping.put("Original Claim Amount Billed", "1234.00");
> fieldMapping.put("Original Claim Amount Paid", "10.25");
> fieldMapping.put("Claim", "");
> fieldMapping.put("Appeal of Medical Necessity Utilization
> Management
> Decision", "");
> fieldMapping.put("Request For Reimbursement Of Overpayment",
> "");
> fieldMapping.put("Seeking Resolution Of A Billing
> Determination", "");
> fieldMapping.put("Contract Dispute", "");
> fieldMapping.put("Other_2", "");
> fieldMapping.put(" DESCRIPTION OF DISPUTE", "");
> fieldMapping.put("EXPECTED OUTCOME", "");
> fieldMapping.put("Contact Name please print", "");
> fieldMapping.put("Title", "");
> fieldMapping.put("Signature", "");
> fieldMapping.put("Date", "03/11/2016");
>
> try {
> pdf = PDDocument.load(new File(inputFile));
> PDAcroForm form =
> pdf.getDocumentCatalog().getAcroForm();
>
> if (form == null) {
> System.err.println("Error: This PDF does not
> contain a form.");
> } else {
> for(PDField pdField : form.getFields()) {
>
> //StringBuilder sb = new
> StringBuilder();
>
> //sb.append("fieldMapping.put(\"").append(pdField.getFullyQualifiedNam
> e()).append("\", \"\");");
> //System.out.println(sb);
> //System.out.println("'" +
> pdField.getFullyQualifiedName() + "'
> type: " + pdField.getFieldType());
>
> String value =
> fieldMapping.get(pdField.getFullyQualifiedName());
>
> if (null == value || "".equals(value)) {
> continue;
> }
>
> pdField.setValue(value);
> }
>
> //fdf = form.exportFDF();
> //fdf.save(outputFile);
> pdf.save(outputFile);
> }
> } finally {
> close(fdf);
> close(pdf);
> }
> }
>
>
> JR
>
> On 3/10/16, 3:46 AM, "Maruan Sahyoun" <[email protected]> wrote:
>
>> Hi,
>>
>>> Am 10.03.2016 um 10:20 schrieb Piotr Kulbicki <[email protected]>:
>>>
>>> It doesn't return null. It returns empty list. From AR is it possible
>>> to export data into xml.
>>
>> you can try PDAcroForm.xfaIsDynamic() - if that returns true the form you
>> are having is a dynamic XFA based form which doesn't have an 'classic'
>> PDF fields as the form is rendered at runtime. To get the data you need
>> to
>>
>> PDXFAResource xfa = PDAcroForm.getXFA();
>> Document xmlDocument = xfa.getDocument();
>>
>> and then grab the xfa.datasets.data node from the xmlDocument. You could
>> also get the xfa as a byte[] using xfa.getBytes() if you'd like to
>> process it via XSLT or a streaming parser.
>>
>> BR
>> Maruan
>>
>>
>>> Should I attache file into email?
>>>
>>> With best regards
>>> Peter
>>>
>>> Dnia 10.03.2016 o godz. 10:14 Gilad Denneboom
>>> <[email protected]> napisaĆ(a):
>>>
>>>> If getAcroForm returns null it means there are no form fields in the
>>>> file,
>>>> at least not any valid ones...
>>>>
>>>> On Thu, Mar 10, 2016 at 12:23 AM, Ruggentaler, JR <
>>>> [email protected]> wrote:
>>>>
>>>>> How do I list and set/update the input fields in the attached PDF
>>>>> document
>>>>> using PDFBox? In the code snippet below form is null. If my PDF does
>>>>> not
>>>>> contain a PDAcroForm how do I access the input fields?
>>>>>
>>>>> try {
>>>>>
>>>>> pdf = PDDocument.load(new File(fileName));
>>>>>
>>>>> PDAcroForm form = pdf.getDocumentCatalog().getAcroForm();
>>>>>
>>>>> if (form == null) {
>>>>>
>>>>> System.err.println("Error: This PDF does not contain a form.");
>>>>>
>>>>> } else {
>>>>>
>>>>> for(PDField pdField : form.getFields()){
>>>>>
>>>>> System.out.println(pdField.getValueAsString());
>>>>>
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>> } finally {
>>>>>
>>>>> close(fdf);
>>>>>
>>>>> close(pdf);
>>>>> }
>>>>>
>>>>>
>>>>> JR
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>