Convert FDF file content into PDF readable format as attachment using APEX - salesforce

I have an FDF format attachment which needs to be converted into PDF format attachment. I am facing issues while reading the FDF file content.

I believe FDF formatted files are not text files. While you can technically read any file in Apex, you will not be able to parse the file, since it's in a format designed to be ready by an Adobe product.
The only way to work with this from Apex would be to run the Acrobat Forms Data Format Toolkit on another server and then perform a callout from Apex to the other server. Apex itself will not be able to work with the format.
This concept of running a web service as a form of middleware is commonly used and Apex does make it very easy to perform callouts.

Related

Uploading .txt file to Salesforce

In our company we receive files from the banks in .txt format, where information about each payment from a customer is stored as numbers. I want to upload this file to Salesforce, but it seems like it's not possible to upload .txt files to Salesforce, only .csv. What I am trying to do is to parse them based on a set of rules and put each one of these payments in their own record in a "Payments" object.
Is there any way to do this using Apex or Visualforce? Or both?
You will need to convert it to a csv file, so it will need to be a manual job. You could write a script to do it for you but as for native Salesforce functionality there isn't anything
Using a VF page it can be done. It's rather complex (and it might be easier to convert the files to .csv and use the Data Loader), but it could be fun.
First, create a VF page that uses a StandardController for Payment__c (might not be required, depending on what you want to do) and an extension MyControllerExtension. In the VF page, provide a apex:inputFile component to get the .txt file.
When the file is selected, call a function in MyControllerExtension that will parse it into separate Payment__c records.
Finally, use a standard DML call to insert them insert myPaymentsList.

Does angular provide any library or plugin to convert server side binary data to pdf or excel format

I have a requirement that my server will be sending data in binary form but I have to show the data in pdf or excel format.
Does angular provide any way to do so.
Please help.
https://stackoverflow.com/a/21732039/1618775
Try this, it can be your solution.
I advice you convert binary to pdf at serverside.

File Maker Scripting - Sending Different Attachment

Is there a way to send a mail with different PDF file to different contacts using file maker?
I am aware of sending batch emails with one attachment but I would like to send a personalize PDF for each contact which seems not so simple.
Also
Can I add PDF files to the table itself or would I have to use the path to the file?
Example:
Table 1
**Name** [James Brown] [James Blue]
**Email** [brown.j#gmail.com] [blue.j#gmail.com]
**PDFfileAttchamnet** [folder/PDF/JamesBrown.pdf] [folder/PDF/JamesBlue.pdf]
So an Email for James Brown would look like:
Dear James Brown, please see the attached file.
Attachment [JamesBrown.pdf] {actual file}
and
Dear James Blue, please see the attached file.
Attachment [JamesBlue.pdf] {actual file}
I think you can solve it by creating container field in you database and import the pdfs in it.
then you can use export Field Contents[] to export it and send it by email
Hope it useful
I would like to send a personalize PDF for each contact which seems
not so simple.
Find the records of contacts you want to include and loop among them, sending mail to each one individually (i.e. without selecting the 'Collect addresses across found set' option).
Can I add PDF files to the table itself or would I have to use the
path to the file?
You can do either, it's up to you. If the path to the file can be calculated (as in your example), you can calculate it right there in the Send Mail script step.
Note that you can also generate the PDF files during the process itself.
Do I understand correctly that you would actually like to personalize the PDF document(s)?
This is possible, maybe not very simple, but quite simple. The trick is to prepare the PDF as a form, and then fill the form fields to personalize.
PDF has a native forms data format (called FDF), which is described in ISO 32000 (as well as the older PDF specification documents provided by Adobe, as you can find in the Acrobat SDK, downloadable from the Adobe website).
FDF is a simple structured text file, which can easily be assembled using FileMaker (I have done that routinely for several catalog projects). The easiest way to get going is to open the form in Acrobat, fill in the fields, and then export the data as FDF. This gives you the pattern to "fill in the blanks".
So, you create the FDF files using Filemaker. With them you can fill the blank form and feed the saved document to the eMail system.
Which tool to use to fill the blank form depends on the volume you have to process. Acrobat is not very powerful (and you may end up in a bit of a legal gray zone, because Acrobat is not set up for being used as a service). There are applications which are made specifically for filling out forms on a server (such as FDFMerge by Appligent), or there are also several libraries which have the tools to fill out forms (iText or pdflib come to my mind). These applications also allow you to flatten the PDF, which means that there are no longer form fields, but their contents becomes part of the base.
The resulting file can now be either made to an eMail attachment, or you make it available on a server and send an eMail with the link to the file (which method you will use may depend on security and privacy regulations).

Creating Excel File in Apex code

'm wondering is it possible to create Excel or CSV file in apex code (as attachment) is it possible ? currently i only see it works with VF page, but i'm looking to do it in apex code not using vf page, I don't see any options.
Any help is appreciated.
Thanks
Unfortunately there is no native CSV Library or API in Apex to handle the creation of CSV files. Certainly not XLS documents although you could use the native XML DOM libraries to create an Excel friendly XML document.
To write a CSV, this should be fairly simple; it's basically a big huge string with a carriage return and/or line feed at the close of each full record write. You'll need to carefully manage property value escapement by using String.replaceAll('\','\''); etc. Which in turn will chew up your script statements pretty badly.
Next, create a new Document(), convert your string to a Blob using Blob.valueOf(String) and instantiate that blob as the body of the Document.
If you are planning on writing a very large document, you may want to consider writing to some other format type or offloading this processing to a remote system (EC2?) and letting it respond with the Document in time.
I have some Apex CSV utilities already written if you need them.

Write Microsoft Project file

I have a requirement to export to Microsoft Project from my company's program. As far as I've seen there are a few options:
Use one of the interchange formats, e.g. xml, mpx, mpd
Use the COM object model and automation to write the file
Buy a library that can write the files
The interchange formats have the problem that they will give you an import dialog when you open them, and if you want to save in a different format you need save as, and you need to select the file format before opening them. I.e. it's not a smooth experience for the customer.
Automation requires everyone who exports from our program to have MS Project installed, which is not acceptable.
The only library I could find was Aspose.Tasks which only writes into the Project XML format.
Does anyone know of any library that can write native mpp files? I've seen a post from Microsoft that they have no intention of documenting the file format, but there are some Project Viewers out there so someone must have done something with it? (Although reading from it can be done with an OleDB provider now that I think about it).
Anyone? Write MPP files?
The .NET Framework has the Microsoft.Office.Interop.MSProject set of classes. You could use them directly if your app is .NET, or write a dll in .NET and then reference that from your app.
I have never had reason to import or export Project files in non-native format but for kicks I just created and exported a simple Project in .XML format. Sure enough, when I open that file using the user interface I have to decide if I want to:
a) open as a new file,
b) Append the data to the active project or
c) Merge the data into the active project.
But, if I open the file using a VBA statement:
FileOpenEx ("Project1.xml")
I'm not troubled by the multiple-choice exam. If the default option provided by FileOpenEx is appropriate you could concoct a very simple procedure to which you could direct your users. I'm not sure if this meets your need?

Resources