Is there a way to set a file name when jspdf output() - pdf

My site draws a column chart. I have a button to save it as a PDF file showing it before saving.
The way it works now is this.
google.visualization draws the chart.
html2canvas takes a screenshot of the chart.
jsPDF inserts the screenshot in a PDF file and shows it to the user.
The problem is the name of the PDF file. It is something like 5d78c1eb-0829-4e7e-8ffc-71cf1f102f56.pdf and the url is blob:http://example.com/5d78c1eb-0829-4e7e-8ffc-71cf1f102f56
When user sees the PDF and clicks save he receives this awful file name.
Now I show the PDF this way:
window.open(doc.output('bloburl'), '_blank');
I can set desired file name if I change this line to this:
doc.save('sample-file.pdf');
But in such a case the file just downloads but I need to show it first.
Is there a way to show the PDF and give it a desirable name? I tried this:
window.open(doc.output('bloburl', {filename: 'myFileName.pdf'}), '_blank');
But it did not help.
Another way I see is not showing the PDF from jsPDF, but sending images to the server and making a PDF file there using TCPDF. The files made with TCPDF can have a name I give it, but I think it is dumb to send the images there and back.
So the question is how can I make a PDF and show it to the user with the name I want?

At the moment the answer is no. You can download it directly, as mentioned in the accepted answer of this question: Download with filename
But you create an objectUrl and therefore the filename is always the url.
Maybe you could create an browser-extension for this...but I haven't had the time to try yet. Furthermore, you can't expect your visitors to have the extension installed.

Related

Illustrator/PS images when sending to another computer?

I'm not sure how Photoshop works but when I receive an AI file from another computer I get an error regarding the images:
'Could not find the link file 'exampleimage.jpg'.
So I'm guessing the other person would have to send me the images separately?
Is this how Illustrator works?
I'm sure for Photoshop you don't have to do this?
Any info would be helpful.
Cheers
In Illustrator, if you go to menu File/Place, this will allow you to place other art files directly into your open illustrator document. If someone gives you that illustrator file and they do not give the "placed" files as well, when you open the illustrator document it will give you that error message because it cannot locate those files that were placed.
While using the "place" command in Illustrator, if the "link" check box is selected, anytime a placed file into illustrator gets edited and saved outside of illustrator, the edits made to that placed file will update the changes in Adobe Illustrator.
If the photos in their document are not embedded, you will need the images separately. Once you have the images, when you open the file on the new computer, you may need to manually associate the photos with each placeholder to make sure it renders properly.

Display the pdf through a link in database

I am working presently on the adf side and I am stuck with some issues.
I have a page where I have to display the pdf files. The pdf files are in another site and the links are present in a column of the database.But when I try to access those links they are downloading rather than displaying. I need to display those pdf files in my inline frame rather than downloading.
I heard many suggestions like write a bean and put the file in session and get display them in page .But I am not clear.
So please help me on this.
I have a check box at the end and the checkbox should be enabled in my page only when the displayed pdf scrolled to end.
Please help me solving those issues.
When you create a link to a PDF there is only so much you can do to make it display in the browser. The most important thing you must do on the server that delivers the PDF is to make sure it is presented with the correct MIME-type and without a content-disposition header value of attachment.
After that, it's up to the browser to either show it in a browser tab or to download the file. I know Chrome will show the PDF in the browser when it's linked to, not sure if it also does that when it's linked in an iframe.
I don't think there's a reliable way to make it work the way you want, simply because it's very browser dependent.

Change PDF title in browser window

I have a pdf file that I am putting on a website for a client. It is located here...
http://www.optiphysicaltherapy.com/dev/wp-content/uploads/2014/02/OPTI_NewPatientForms.pdf
The title should be OPTI New Patient Forms but if you look at the tab in the browser and the name at the top of the browser window it says "Coury And..."
Where can I go to change this?
The website is using Wordpress 3.8.1 and I am not sure if it is in Wordpress or in the actual pdf file.
Thank you,
Matt
Ok, So I found out how to change the meta-data in a .pdf form here: http://help.adobe.com/en_US/acrobat/X/pro/using/WS58a04a822e3e50102bd615109794195ff-7c63.w.html (dead link; archived version here)
Sure enough the Title in the Meta Data within the .pdf was "Coury And..."
Once I changed this the Tab and the Title in Firefox web browser changed to have the title that I wanted.
This shows us that the meta-data in the .pdf does show in Firefox as if it were the meta-title of the webpage when displaying a .pdf within the browser.
Open the PDF with Notepad++ and search (CTRL+F) for /Title
Change title between brackets (and leave the brackets)
For instance:
Change "/Title (OLD TITLE)" into "/Title (This is my new title)"
Save the PDF and Voila
If you have access to the Word document in which the PDF is based, you can define the title when you save the file.
Whatever was on that link, I did it opening the PDF with a hex editor (HxD) and searching Title, so I found /Title (untitled) somewhere and just edited it (changed the value between parentheses, here untitled).
no need to change in meta of pdf. just to following change in iframe url
http://localhost:8080/getDataPDF//?patientId=145. use // to solve this problem it can hide your title.
Open the PDF document in Adobe Acrobat Pro: (OR use google chrome extension)
(1) Go to Select File > Properties
(2) Select the Description tab to view the metadata in the document, including the document information dictionary
(3) Modify the Title field to add or change the document's Title entry
When you open pdf in chrome you can hit print and save as pdf. As file name write what you want as title in browser, it should be the same now.
Open File > Properties, then in the box labeled 'Title', add your title.
Click on the 'Initial View' tab, where it says Show:, make sure the drop down says 'Document Title' instead of 'File Name'. This works for Chrome, but sadly not IE yet.
For change my pdf tittle I just open it on nano terminal, or with another text editor that open the raw, and I edit the Title field.
The title can be changed inside MS Office or LibreOffice if you have access to the source by going to file/properties/description.
As another answer suggested, printing as a PDF works here if you have the source document. What the other answer perhaps got wrong was that there is an option to add a title in the print dialog.
You can also use this online pdf editor to change metadata of a pdf file.
The title does not come from the pdf. it comes from the word file you export it from.
Right click on the word file, go to details. change the title and export again
Good luck

Extract "cover image" from CHM and EPUB files

How can I programmatically and reliably create PNG images from CHM and EPUB files? The page that's needed is only the first one, as in "cover image thumbnail generation".
Could this even be done just from the command line?
I have already looked at the open-source CHM QuickLook plug-in for MacOSX for source that does this and at Calibre, the latter to no avail.
In CHM, the default page is a webpage (a .html file). Of course it can only contain one page.
An extracter program is easy to do based on chmlib or Free Pascal's libs, but it will need the html parsed to also find names of other programs to extract. Roughly the algorithm would be:
use some "list" function of a cmdline extract tool to get the default page's name. (this is stored in an internal record)
extract it, and parse it for img and other referencing tags.
extract those.
The biggest picture downloaded in the previous step is probably "it"!

Customize PDF view inside a browser

I've worked on a requirement that allows me to show a PDF file inside a browser by doingo a Response.ContentType = "application/pdf".
The problem is that the default view of the PDF is always showing the bookmarks menu at the left, is there a way by using HTTP headers or something to tell the PDF viewer not to show the bookmarks section?
Thanks in advance.
There's two ways that you can do it. The way that I would recommend is to actually open the PDF in Adobe Acrobat and go to File, Properties. On the Initial View tab you'll see a lot of options for how to display the PDF. The second way I haven't tested but Adobe says you can pass various querystring options to the PDF. The one you'd probably want is http://example.org/doc.pdf#pagemode=none
The way how a PDF document is displayed can be configured inside the PDF document.
There are a lot of PDF editors that can modify the "viewer preferences" as it is mostly called. One free example is BeCyPDFMetaEdit.