1

How can I set the default FileName when printing a FlowDocumentReader.Print() to PDF?
Not a hard coded name - with each Print I want to set a default FileName.
And they are not printing to PDF every time - user may select PDF as the printer.

FlowDocumentReader.Print Method

paparazzo
  • 44,497
  • 23
  • 105
  • 176
  • I remember to know that after selecting the PDF "printer" or Microsoft XPS "printer" there will follow another dialog where you are prompted for a file location + name... Did you actually hit "Print" in the dialog shown in the documentation (in the link you provided)? – Youp Bernoulli Sep 06 '15 at 19:50
  • @YoupTube No kidding it comes up with dialog where you are prompted for a filename. I want to set a default or starting filename. – paparazzo Sep 06 '15 at 20:04
  • Phew...don't think that you can intercept that. It's "default" behavior of the printing dialog I suspect when selecting a "file printer" rather than a "real" printer ;) – Youp Bernoulli Sep 06 '15 at 20:11
  • @YoupTube You can with PrintDocument.DocumentName but it is not exposed with FlowDocumentReader.Print that I can find. – paparazzo Sep 06 '15 at 20:20

1 Answers1

-1

Check out these two answers:

One in VB.NET easily converted into c# as per your preference

Or this one

In both cases there are still some issues I believe as I have scanned the answers. But it might give you some clues ;)

Community
  • 1
  • 1
Youp Bernoulli
  • 5,303
  • 5
  • 39
  • 59
  • I already know how to do it if I issue the PrintDialog. I am specifically asking how to do it with FlowDocumentReader.Print() – paparazzo Sep 06 '15 at 20:24
  • But, from the documentation it states: "Invokes a standard Print dialog which can be used to print the contents of the FlowDocumentReader and configure printing preferences." So that's the way to go or isnt't it? You are "forced" to go the way of the print dialog as per the documentation ;) – Youp Bernoulli Sep 07 '15 at 08:49
  • Do you have an answer to the stated question or not? – paparazzo Sep 08 '15 at 09:27
  • Didin't investigate any further... you didn't asnwer or comment on my latest comment so I have no further ideas so far. – Youp Bernoulli Sep 08 '15 at 13:06