You need to sign in to do that
Don't have an account?
yogesh goad
Display only first 2 pages of pdf file in browser
i have uploaded a pdf file using document object in salesforce. i am using the below code to display that file in a pop up window in my browser. my requirement is to show only the first two pages of that file and not the whole document in the browser.
<apex:repeat var="dc" value="{!details}">
<tr>
<td><a target="_blank" href="https://c.ap1.content.force.com/servlet/servlet.FileDownload?file={!dc.id}" onclick="return windowpop(this.href, 545, 433)"> {!dc.Name} </a></td>
<td>{!dc.Type}</td>
</tr> </apex:repeat>
<apex:repeat var="dc" value="{!details}">
<tr>
<td><a target="_blank" href="https://c.ap1.content.force.com/servlet/servlet.FileDownload?file={!dc.id}" onclick="return windowpop(this.href, 545, 433)"> {!dc.Name} </a></td>
<td>{!dc.Type}</td>
</tr> </apex:repeat>
Instead of these can we have a map instead of list "details".
Map detailedMap = new Map<id, MinimizedPDF>();
MinimizedPDF(){
PageReference pr;
Blob pdf;
pr = New PageReference('https://c.ap1.content.force.com/servlet/servlet.FileDownload?file={!id} );
pdf = pr.getContentAsPDF(); /* TRY TO FETCH JUST 2 PAGES INSTEAD OF COMPLETE PDF*/
Attachment a = New Attachment();
a.body = pdf;
a.parentID = f.id;
a.Name = 'FSA.pdf';
insert a;
}
your solution is not clear to me.
i think you dint get my question properly.let me state the question clearly.
i am using the below code to upload a document in salesforce and iam using this controller to fetch a list of all uploded documents i am using the following vf page to display the list now i get the following display
when i click on the link under the title header of table it shows me the entire document in a pop up window as below
what i want is to only show the first two pages to the user who clicks on the link under title header in the table.
hope the question is clear now.