TMSFNCPrinter with Android

Hi,
I am using Android 11 and SDK 25.2.5

I can't get TMSFNCPrinter working with Android 64bit.
I get an error when printing:
Java Type FNCPrintDocumentAdpater $FNCPrintDocumentAdapterListener could not be found
I am printing with TMSFNCPrinter.OnDrawContent as indicated.

Even the demo example is not working at all. The app is blocked at the splash screen.
Same with Android 10

Thank you in advance

As mentioned in the PDF dev guide page 3:

Important for Android implementation: It is necessary to add the FNCPrintDocumentAdapter.jar or
the combined FNC JAR file to your project libraries! This file can be found in the Android Support
folder in your installation directory.

Hi Bruno,

Indeed. Sorry for that.

But still. I can’t print from Android using your demo app or my app.

Nothing is happening.

How can I investigate what’s happening ?

On windows, when printing to Adobe PDF, the “Creating Adobe PDF” dialog remains Open with intermediate progress

image002.png

Hello,

The problem with the demo code for Android (and iOS) is that I've added a TPrintDialog.
This is used for Windows and Mac deployment, but doesn't exist in Android and iOS.
But apparently Delphi doesn't throw an issue if you use it in the code.

Normally the demo should work if you just remove the line:
if (PrintDialog1.Execute) then

For the Adobe PDF creation, unfortunately we don't have this installed here, but can you check if you have the same issue with 'Microsoft Print To PDF'?
This worked for me on the FMX and VCL demo.

Hi Gjalt,

Thank you for your feedback.

Yep, I already figured that out and added

{$IF Defined(MSWINDOWS) or Defined(OSX)}

if (PrintDialog1.Execute) then

{$IFEND}

TMSFNCPrinter.BeginDoc;

This is indeed working now on Android by showing the preview.

That could be added to your demo. :blush:

For the PDF issue, this is another story:

1. with 'Microsoft Print To PDF'

The Save Dialog is asking for a file name and save the PDF file.

Adobe Acrobat is not opened automatically.

The PDF file is correctly generated.

2. with Adobe Acrobat

Adobe Acrobat is opening with the generated PDF file.

A file without a name (.pdf) is saved in User\document

As mentioned, the ‘Save as PDF’ dialog from Adobe Acrobat remains open with unfinished progress

I don’t have Adobe Acrobat on my Mac to test this.

Cheers

We have specific components for PDF printing, on these you can set if you want to open the document on closing or not.

This is a video on TAdvPDFLib, but you can use TTMSFNCPDFLib on FNC.
Gjalt's101: AdvPDFLib

Perhaps you can check if this works as expected.

Otherwise you might also check if the document completes when you create the code with the Delphi TPrinter.