I'm generating some PDF on my site (with FPDF library) and I can't manage to change the title displayed in the browser (not the one when downloading, but the one corresponding to the HTML)
<title></title>
Have you any idea ?
Yes you can set/change the title by:
$pdf->SetTitle('Title');
Reference: http://www.fpdf.org/es/doc/settitle.htm
Related
My pdf file is open in browser tab. In the title of pdf tab instead of name it shows the url how can i changed it .I am using codeigniter framework and using Mpdf library for pdf.
Your PDF document should have Title metadata set. Afterwards, browser will use it for rendering tab title.
http://www.w3.org/TR/WCAG20-TECHS/PDF18.html
In Acrobat Pro, open the PDF and select File -> Properties -> Description and then edit the meta data title (and others if required) as you see fit.
We only saw the title being displayed like this in Firefox.
Put it in a div inside a page and change the page title like this:
<head>
<title>YOUR TAB TITLE</title>
</head>
and then:
<div>
<object data="test.pdf" type="application/pdf"
width="300" height="200">
alt : test.pdf
</object>
</div>
You can also set the object width and height to match the page.
Reference
For changing PDF tab title in browser, you need to update "title" in property.
If you have PDF editor you can do it easily. Else it is not editable.
You can use any of the tool online to edit the title.
I did it using below link.
https://www.sejda.com/edit-pdf-metadata
Try this. It's so simple.
$mpdf->SetTitle('My Title');
I am using DomPDF to generate PDF-Files. This works fine, but I want to set the default page layout which is used by opening the document. I want to have a 100% view when the document is viewed. Actually the page is streched to the max width of the window.
Does anybody know a solution how to set the page layout to "single site"?
Regards,
Lothron
You can do this in dompdf by specifying the view in a meta element, e.g.
<meta name="dompdf.view" content="FitV" />
or
<meta name="dompdf.view" content="XYZ,0,0,1" />
You can also call the set_default_view() method of the canvas class, e.g.
$dompdf->get_canvas()->set_default_view('FitV')
Using the above method can only be done after the PDF document has been instantiated. As of dompdf 0.6.1 that is done after calling $dompdf->render().
Ref: https://groups.google.com/d/msg/dompdf/7L2xMLwmH-Y/Et2mBNny51QJ
Is there any way i can load PDF file (its contents) in a div or iFrame?
I have a bunch of PDF files on a server and, ideally, i need to have a button 'Show file' on a page, clicking on which will load the contents of selected file in a div(iFrame).
You can also use google pdf view by using iframe on your page :
<iframe src="http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
Instead of this in above code :
http://infolab.stanford.edu/pub/papers/google.pdf
Use your own PDF file path.
You can view the demo here.
http://googlesystem.blogspot.in/2009/09/embeddable-google-document-viewer.html
It's just a suggestion. No downvotes please.
Google's gview is sometimes unresponsive and given 204 status. Here is the best free alternative.
https://stackoverflow.com/a/66548544/2078462
I have a PHP script which displays a PDF inside an object element. Adobe Reader plugins handle this fine and using the Adobe toolbar users can print the embedded PDF. However, some users insist on using the File menu (98% of users on Internet explorer 8) to print the HTML document. Utilizing this File->Print menu in IE, the HTML document is printed out without the contents (PDF) of the OBJECT element. (Print Preview) Using this method to print the document in Chrome or FF results in only the data currently shown in the Object viewport, to be printed. That is, a partial object and not the actual PDF.
I have searched and read a few related questions on StackOverflow, but nothing specific to this situation or case. Some of these 'solutions' use a Javascript method or function to print the content via a button or link. If I can't get my users to use the Adobe toolbar in the browser to print a PDF, I doubt they'll change their minds to use a button that says 'PRINT'.
Why does the File->Print method in IE result in a blank page? Is there a way to make the browser print the contents of an Object element when using the File->Print menu. No JS hacks, buttons, links to 'click here', iframes, or suggestion to 'display it inline' etc.
For reference, the code for this 'View PDF' is below (which, again, works fine to display the PDF content in the object element; no issues).
echo "
<html>
<head>
<title>View PDF</title>
</head>
<body scroll='no'>
<object data='getFile.php?f={$file_hash}' type='application/pdf' width='100%' height='100%' >
<h2>Error: No PDF plugin</h2>
<p>The browser does not have a PDF viewer installed. In order to view the PDF in the browser, please <a href='http://get.adobe.com/reader'>download Adobe Reader</a>. </p>
</object>
</body>
</html>";
As far as I know there is no solution for this issue. I have seen some developers "solving" the problem by generating a PDF file that automatically shows the print dialog when opened
Another option could be to show the PDF file in a new window that removes the toolbar and menus in order to avoid the visual ambiguity.
Window.open(url, "_blank", "location=0,menubar=0,toolbar=0");
I do not know if this one works, but you could try detecting the browser print event, then calling pdfDoc.printAll(); on your Acrobat Reader object.
Open just the PDF - without the HTML & object. Then File->Print will always work.
Of course it depends much more on the browser/reader configuration if the PDF is displayed in the browser or opened in a new Reader window
I have an applicaton written in PHP that retrieves files from mongoDB Grid collection, and allows a user to view/download them based on if they're an image or not.
It's all working fine, except that the title bar of the browser displays the name of the php file I'm running the script in, rather than the filename of the image that's displayed. for example:
myphpfile (JPEG 1024 X 768 pixels)
I'm not sure if it's possible, but I'd like to change it if it is. If I right-click and select save as I get the correct image name, as user header() I've set:
content-disposition: inline; filename="thefilename"
I've also tried setting name with the content-type with no success.
Thanks for any help.
The only possible way is not to open image directly in the browser's window, but a simple HTML code like this:
<html>
<head>
<title>
Put your title here
</title>
</head>
<body>
<img src='your_script_generating_images.php?parameters'>
</body>
</html>
But did you think about some fancy and nice solutions like http://highslide.com/ or http://fancybox.net/? All that you need is to set the links to your script generating images and to update the page title correspondingly (which is not even required as you can write information you want just above the image in popup).