TEdgeBrowser, how to set the filename for save to pdf - delphi

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?

Related

Render Images in document.directory in a markdown file in swift(SwiftyMarkdown)

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!

Display pdf with file selected from file input in iFrame

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)

How do I detect whether the user is printing to PDF?

I'm using Delphi 7 and want to know if the file is printing to a PDF device so I can do some special processing. This is what I have to get it to work.
// If the printer is a PDF type it will ask for the file name here.
Printer.BeginDoc;
// The next line returns the file extension of the original file name and
// not the extension of the file being printed to.
Extension := AnsiUpperCase(ExtractFileExt(Printer.Title));
// I've added this line to get it to work but want to be able
// just check if the current child is being printed to a pdf device.
if CustomPrintDialog.ActivePrinter.Caption = 'Adobe PDF' then

Using printer name Adobe PDF

I have looked everywhere for this solution. The code below allows me to print to the printer, Adobe PDF, but what I want to do is automate the file name save as screen with a generic name and in a specific folder. For example, the file would be saved to C:\temp\tmpResize.pdf and I am having problems there.
var params = this.getPrintParams();
params.interactive=params.constants.interactionLevel.silent;
params.pageHandling=params.constants.handling.none;
params.fileName = "/c/temp/tmpResize.pdf";
params.printerName="Adobe PDF"
this.print(params);
Thanks for your help.

Get the filepath of an image inserted into TWebBrowser in edit mode

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.

Resources