Ms Print to PDF = Ms XPS Document Writer?

Hello,

eBilling again …

I need by law to send an email with attached PDF to some customers:

20503152170-01-F001-123.pdf
^^ constant ^^ ^^TTag^^

I can make it work with Ms print to PDF but the Save As popup kills the automation:
I have to enter the filename manually.

So I have been spending the day to find a solution, CuteFTP, bulldog/BioPDF, Adobe, etc …
Reading the forum and the net.

I saw on StackOverflow that both printers:

Microsoft XPS Document Writer
and
Microsoft print to PDF

use the same PrintDocument object (and Both can assign the filename using the same method)

As Ms Print to PDF is now standard on windows 10,
As @emre already did include:

Save Document to File Printer (with filename setting) for Custom Printer

Which saves the Document in .xps when PrinterName = "Microsoft XPS Document Writer",

I was wondering if it would be possible to do the same for Ms Print to PDF, so

Custom Printer > Save PDF to File Printer (setting)

It is just a question, it might be stupid question because I don’t know the windows environment, nor SambaPOS inside :slight_smile:

The good thing would be not so “3rd party PDF writer”, the bad thing would be writing Document template.

I also used to send customers invoices , lot of customers said they cannot open xps in the system, they might be using mac, or somethjing.
so i save this as pdf with same file name and it will send email always with same name, it asks to overwright , otherwise i tried cute pdf which is good and can save to same file . However pdf is very common and popular nowadays, hope one day we will have all reports genarate in pdf too looking forward for this feature .

I agree having a native feature to save reports etc as PDF would be very beneficial. Customers want PDF, they don’t understand what XPS is and even it opens in any Windows PC, you need apps to open it on iPhone or Android, which most customers want to do with their reports especially if sent by email.

Just gotta say though, this is crazy…

Can’t see how it would be just some customers.surly laws would Beall or nothing

To make it short:
I emit 2 types of Bills for the same meal but different types of customer:

  • Boleta: basic (a lot)
  • Factura: for customers realated to company and who want to put their meal in their company cost.

For factura I need to send mail. (i is not exactly true, it is much more stupid than that but the fact is that, yes, indeed, I need by law … if you are interested, I send you theprocess via pm.)

@plume thank you very much for sharing the tip.

We’re using flow documents to format document prints. Flow Document is a Microsoft format (like pdf) to prepare rich text documents and you can easily print them or save to xps file without using a xps printer. We’re using this method.

There are multiple ways to create & print a document in Microsoft world. One of them is good at printing flow documents. Other method is great for printing images, etc…

Unfortunately using PrintDocument class method just solves file naming issue however it only provides functions to draw / type stuff into a blank canvas. It can’t just print a flow document. The other method to print the flow document does not have “File Name” property like the PrintDocument class.

So we need to convert Flow Document format to PDF. There is no way to solve that without using third party tools. I know there are lots of PDF Creation tools but we need some specific features. Some tools does not support them or they support it but costs a fortune.

So you need to send receipts in PDF format by law. Obviously you don’t want to deal with file names…

To be able to solve that I created a custom printer (Save Text to PDF Printer) that uses PrintDocument class to send printout to Microsoft PDF Printer without popping up the file name dialog. However it only supports plain text. Hope it helps.

You’ll be able to use it on next update.

4 Likes

Thank you very much for your time emre, I know it a really precious ressource.

And thank you for your explaination, precise and straight to the point.

I love plain text for data administration and I will use the new PDF printer to send to my self information on my mobile phone :smiley:

For my customers I am affraid that it will not be sufficient:

  • Logo is optionel, so ok
  • Qr Code is opcional right now but will be mandatory as from Feb 2019.

Once again, thanks for your time,

Marc

lol while thinking about how to print the logo image I thought converting whole document to a single image and print image to pdf. I think that worked great…

On next update Enable Convert To Image setting on Save To PDF Printer printer

7 Likes

I tried this , peefectly saving without poping but befor when print to pdf it was printing in A4 size , now its showing in half the page only . I tried to change line character count , but no change . Is any setting we need ? I try to attach a pic when am at computer .
This solved my invoice sending through mail, before i always need to save with same name and same loaction . thank you @emre . And the same can we do with reports save yet ?

Hi Emre,

Is it supposed to print out the logo/Qr ?

I try it.

Without enabling Convert to Image, it works but only text.

With Convert to Image enabled, I have the following error:

errorConvertImage

Message might be obvious for some people, but not for me :smiley:
It looks like xml related stuff.

@plume just so you’re aware Emre passed away in February so you may need to hang on a little for someone else to pickup your question

Ok i took this to our development backlog

any news on pdf format devolopments

We are working on some new solutions with Metrik v2. Wait for that I think it will solve your needs.

1 Like

Yes you can get PDF reports directly from Metrik