function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GoForceGoGoForceGo 

File I/O, pdf handling

Does Apex support any file I/O

Here is what I need to be able to do:

I have standard pdf document which has an underlying XML schema.

I need to fill out some information in this pdf (programatically) and e-mail it a contact.

Anyway to do it in Apex?

I know there is an xmlStreamReader and xmlStreamWriter class, but it is not apparent how I would use them to do file i/o to a pdf document (from which I can extract an XML)




werewolfwerewolf
Not really, although I guess if you're really clever you might be able to do something to base64 encode something to put in an Attachment or Document.  Sounds difficult to me though.

Why do you need file i/o to do this?  If you're just emailing information, can't you inline it in the email?
GoForceGoGoForceGo
Thanks werewolf.

I do have to populate some information in this pdf form - e-mailing the information and asking the reciever of the e-mail to type it is not desirable for my use case!




GoForceGoGoForceGo
XMLStreamWriter can be used to create XML stream output.

How does one take the output of an XML stream writer and put in a "document" object.

Then I could get the user to just click on the document and download it their hard drive.

The document object has the file content in a field called "Body" which is base64Binary - seems like document object was designed for Web Services...

Can I somehow convert XML document to base64Binary from within Apex?

My App is native to force.com - I don't want to have to deploy any other clients/servers.





RaizersRaizers
CloudPDF Interactive Forms might be an easy solution for you.  The app populates existing PDF documents with data from SFDC. https://www.salesforce.com/us/appexchange/detail_overview.jsp?id=a0330000005L1WfAAK