Is it possible to display a pdf file that is uploaded from a file input in an iframe with pdf.js?
Use address returned by URL.createObjectURL(inputControl.files[0]) (where inputControl is a file input)
Related
Am using SwiftyMarkdown framework to render my .md file to have dynamic formatted data in my VC. But i am not able to load images in my document directory referenced in .md file. I can load images if they are available in Bundle.
Any other option or framework to fix this issue? I want to dynamically load images from server and save them documents directory and refer them in .md file which is also saved in same documents directory/folder. So the url of image and .md file is same.
"MyFile.md" in documents directory contains below content
Continue your walk, joining up with your original perimeter path of the item. "
In my VC viewdidload, i access the url path and load nsattributed string to my textview using SwiftyMarkdown frmaework
let url = self.getDocumentsDirectory().appendingPathComponent("MyFile.md")
if let md = SwiftyMarkdown(url: url) {
textView.attributedText = md.attributedString()
}
The formatted text is loaded but no image as its not available in my Bundle. But its saved in the same document directory as that of "MyFile.md"
Hope its clear!
With the TEdgeBrowser, how can I programatically set the full path for the filename for print --> Save as PDF ?
The other question is how to select the Save as pdf printer in code?
I am able to use TCPDF and generate a PDF in the browser using JQuery/JavaScript:
window.open("", "pdfWindow",scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");
$("#" + formID).attr('action','tcpdf/example/genReport.pdf').attr('target','pdfWindow');
In genReport.pdf, I am using $pdf->Output('genReport.pdf', 'I');
When genReport.pdf is generated, it appears in a new tab with the standard browser settings. I wanted to know if there is a way to have the generated PDF automatically display in Acrobat Reader?
Any help will be greatly appreciated.
According to the documentation of the output() function, the second parameter can be one of those:
I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects
the "Save as" option on the link generating the PDF.
D: send to the browser and force a file download with the name given by name.
F: save to a local server file with the name given by name.
S: return the document as a string (name is ignored).
FI: equivalent to F + I option
FD: equivalent to F + D option
E: return the document as base64 mime multi-part email attachment (RFC 2045)
So I'd suggest using $pdf->Output('genReport.pdf', 'D'); this will open the download dialog and the user can choose to either open or download the file.
PDF files support embedding arbitrary files as attachments (see here).
I would like to do just that in a Mac and an iPhone application using Objective-C:
Add a file as attachment to a PDF
Read the list of attached files from a PDF and extract one
Use case:
My app uses a custom document format that can only be opened by the app. I'd like to export the document as PDF and embed the original, custom document so that users who happen to have the app installed can modify the document. Everybody else can still open and print the PDF.
You can do this easily with the iOS version of the Debenu Quick PDF Library. Download the sample project and modify it with the sample code below:
How to embed a file
[DQPL LoadFromFile:path_of_my_PDF_file :#""]; //load your existing PDF file
[DQPL EmbedFile:#"Original_custom_document" :path_of_the_original_custom_document :#""]; //specify the name and the location of the attachment
[DQPL SaveToFile:new_path];
How to find the filenames of the attachments (skip if you have only one attached file)
[DQPL LoadFromFile:new_path :#""];
NSString *listItem;
int fileCount = [DQPL EmbeddedFileCount]; //returns the number of attached files
for( int count = 1; count <= fileCount; count++ ){
listItem = [DQPL GetEmbeddedFileStrProperty:count :1]; //returns the filename of the attached file
//show/read or save the returned filenames and the index of it...
}
How to extract an attached file
[DQPL LoadFromFile:new_path :#""];
[DQPL GetEmbeddedFileContentToFile:1 :path_and_filename_to_write_the_extracted_attachment]; //specify where do you want to save the extracted attachment (in this case the index of the attachment is 1)
Pal
(Debenu Team)
When you insert an image into a TWebBrowser in edit mode, how do you get the filepath of the inserted image? When an image is inserted it includes the full path to the image in the html source, but in my case I need to modify the html source to only include the filename.
EDIT:
This is the html source after the image is inserted:
<IMG border=0 hspace=0 alt=delphi align=baseline
src="C:\Images\delphi.bmp">
I need to change
<IMG border=0 hspace=0 alt=delphi align=baseline
src="C:\Images\delphi.bmp">
to
<IMG border=0 hspace=0 alt=delphi align=baseline
src="HTML\delphi.bmp">
Yes I can get the path from the html but I'd like to try to copy the image file to the HTML folder then change the path to the HTML folder after the image is inserted without parsing the html. If the filepath can be obtained after the image is inserted I can add the code to copy the file to the HTML folder so that the image appears in the webbrowser with the new path...
Have you tried using the browser's DOM interfaces to read the src attribute and update it to what you want? Specifically, look at the src property of the IHTMLImgElement interface.