You need to sign in to do that
Don't have an account?

Generate PDF from Excel or CSV from
Hi All,
Is there any way to nuild functionality where user can upload standard SF report file and generate PDF file from that?
How we can achive this using apex/vf?
Thanks and Regards,
Devendra S
Devendra,
Please explain what you are trying to do - are you looking to:
1. User creates standard SF report
2. User exports standard SF report to Excel or CSV
3. User accesses VF page, specifies saved file, system uploads
4. System parses uploaded file
5. System creates PDF output of file (for download or to attach to a record?)
There are a number of other ways I can think of (general business practices) to communicate reported data outside of this kind of method - please describe the business process or question you're trying to answer.
Thanks!
-Andy
Hello Andy,
The steps you have mentioned are correct. I would like to build such functionality for my application. Every time writing a code for generating in PDF format using apex/VF, i am looking for a way, where standard report file will be uploaded as input and output generated as PDF file with customized header and footer for PDF.
You mentioned in your comment,
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
There are a number of other ways I can think of (general business practices) to communicate reported data outside of this kind of method.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I would like to know those practises.
Thanks & Regards,
Devendra
Hi,
You can create a VF page and a custom controller. With the help of that page you will be able to upload .csv file in the document and then generate the PDF of that document. You can also delete that document after generating the PDF.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi Navatar_DbSup,
Can you please guide me through this requirement?
Can you please share code for converting excell file into PDF?
Thanks & Regards,
Devendra
Hi,
You can use the below code as snippet
--- VF page ----------------
<apex:page renderAs="pdf" controller="clsgenratepdf" contentType="html" >
<html>
<body>
{!dipslaytable}
</body>
</html>
</apex:page>
--------------- Apex Controller --------------------
public class clsgenratepdf
{
public string dipslaytable{get;set;}
public clsgenratepdf ()
{
string docid1= ApexPages.currentPage().getParameters().get('docid');
document d=[select id,body from document where id=:docid1];
string strOrgId = UserInfo.getOrganizationId();
dipslaytable=d.body.tostring() ;
dipslaytable=dipslaytable.replaceAll(',','\n').replaceAll('"',' ').replaceAll('>','>');
//dipslaytable= '/servlet/servlet.ImageServer?id=' + '015U0000000EDtxIAG'+ '&oid='+ strOrgId ;
}
}
https://c.ap1.visual.force.com/apex/genreatepdf?docid=015900000003J19
pass your document ID(in the place of Red mark portion) in url
Hi Navatar_DbSup,
Thanks for the reply.
The method you have told is worked well in some extent.
But, i would required to save CSV file as document first and using the document id we can generate PDF report. Is there any way to directly pass CSV/Excel file and generate PDF report file for the same?
I will have to use VF here. It is because, i will have to customize PDF page with header and footer for PDF.
Thanks,
Devendra S
Hi techman97,
Yes, there are other ways to convert CSV/Excel file into PDF format.
In my case, i want to build "Convert Excel/CSV to PDF" functionality for my app. So that user can browse the excel/csv file from his system and will be able to generate PDF file. And also want to give header-footer for the PDF page. So the PDF file will look in proper format. The steps you have mentioned in the post are matches with my requirement.
Is there any way to do this?
Thanks & Regards,
Devendra
Are you looking to store the information in Salesforce - or just use it as a glorified template printing method? If you're just looking to get CSV contents into a PDF document with a header and footer - a Word mail merge wizard using PrimopDF's free PDF printer driver would be far easier (and cheaper) than Salesforce licenses?
-Andy
Hi techman97,
Thanks for the reply.
The requirement is to generate PDF by taking Excel/CSv file as input from the local machine and this should remain as part of a custom application.
Thanks,
Devendra
Devendra,
Take a look at this link (http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html) - it steps through what you need to do to import the local file.
For the PDF generation portion, as part of your import method - PageReference the user out to another Visualforce page upon completion of the upload. That new VF page will be one you create - with all of the header/footer stuff you need. In the <apex:page> tag, dont' forget to set your "renderas="pdf" attribute.
-Andy
I am a beginner of PDF processing.For me ,i have only tried to generate PDF files using this PDF processing (http://www.rasteredge.com/how-to/csharp-imaging/pdf-processing/) tool.There are many third party tool for PDF files.And i think it would be more convenient for new users to own a fine tool.You can also have a try
Read More:
http://www.esofttools.com/pdf-password-remover.html
Could anyone of you help me to achieve below functionality.
I need pdf file should be convert to .csv file and then insert the record as per data in csv file.
I am done with second part but unable to convert pdf into csv file.
Regards
Shikaib