You need to sign in to do that
Don't have an account?
Mélanie Texereau
Add PDF Document to VF Page
Hi,
I have a PDF Quote which is a VisualForce Page, and I would insert a "terms and conditions" document (is a PDF file) in my Visualforce page.
It is possible ? I try to use :
- <apex:image>
- <apex:iframe>
- <object>
and it doesn't work...
Do you have any ideas ?
I have a PDF Quote which is a VisualForce Page, and I would insert a "terms and conditions" document (is a PDF file) in my Visualforce page.
It is possible ? I try to use :
- <apex:image>
- <apex:iframe>
- <object>
and it doesn't work...
Do you have any ideas ?
I convert my PDF file to PNG and put it in static resource. Then, I recuperate this resource in my Visualforce page.
Thanks for your help sunny522.
All Answers
<apex:inputfile> isn't for my problem, I think...
I recuperate a document PDF in Document object ( my document has an id, name, a file associated, etc) and I would display the content of this PDF in my Quote PDF.
you can generate terms and conditions pdf document in one vf page named " page1" . You can now include this vf page in main vf page where you generate Quote pdf.
sample code will be as below.
<apex:page controller="cls_printpage1" sidebar="false" showHeader="false" renderAs="pdf">
<apex:include pageName="PDFDownload"/>
You can include the code that should be displayed in main vf page
</apex:page>
Your solution is interesting but how to insert my PDF content of "terms and conditions" in Visualforce ? I can insert image but a file PDF I don't know ...
you can display "terms and conditions" in vf page using apex controller and then you can use renderas="pdf" in vf page.If you are unable to do like this can u give more description how "terms and conditions " are displayed?whether that is static. or it is generated by some logic?
In my class I recuperate this document with soql : and I would display this document in my visualforce page after my code which display a quote information.
Thank you for your help Sunny522
you can directly display terms and conditions in vf page by querying static resource in controller.
StaticResource resource=[SELECT Id, Body FROM StaticResource WHERE id=:idofstaticresource];
try in this way and let me know if any issues
But when I open my PDF Quote, I have this : core.filemanager.ByteBlobValue@7364c3ce
How to display Blob value ?
You can place "terms and conditions " in notepad as text file and then place this file as static resource.Then create class like this
public class NotepadContent {
public List<StaticResource> docs;
public String content{get; set;}
public NotepadContent() {
docs = [SELECT Id, Name, Body FROM StaticResource WHERE Name = 'Notepad'];
System.debug('******************'+docs);
for(StaticResource d : docs) {
content = d.Body.toString();
System.debug('******************'+content);
}
}
}
visualforce page :
<apex:page controller="NotepadContent" >
<h1>{!content}</h1>
</apex:page>
let us know if it worked
I convert my PDF file to PNG and put it in static resource. Then, I recuperate this resource in my Visualforce page.
Thanks for your help sunny522.