Can anyone share an example on how to implement the asynchronous return of a 
result from an Objective-C callback block to Qt?

For example, see the “successBlock:” below which gets called back 
asynchronously.

    self.PDFCreator = [NDHTMLtoPDF createPDFWithHTML:(NSString*)html
                                             baseURL:(NSURL*)baseUrl
                                          
pathForPDF:[@"~/Documents/hello-world.pdf" stringByExpandingTildeInPath]
                                            pageSize:kPaperSizeA4 
margins:UIEdgeInsetsMake(10, 5, 10, 5)
    successBlock:^(NDHTMLtoPDF *htmlToPDF) {

        NSString *result = [NSString stringWithFormat:@"HTMLtoPDF did succeed 
(%@ / %@)", htmlToPDF, htmlToPDF.PDFpath];
        NSLog(@"%@",result);
        self.resultLabel.text = result;

    }
    errorBlock:^(NDHTMLtoPDF *htmlToPDF) {
        NSString *result = [NSString stringWithFormat:@"HTMLtoPDF did fail 
(%@)", htmlToPDF];
        NSLog(@"%@",result);
        self.resultLabel.text = result;
    }];


Background:
————————

I need to implement native iOS code to replace the missing QPrinter 
functionality I used to convert HTML to a PDF report on Android, OS X, Linux, 
and Windows.

Unfortunately the Qt html-to-pdf functionality is implemented in QPrinter.  
This functionality is gone from Qt iOS since iOS has no printer device support, 
 even though I am not accessing a printer device from iOS.

I found this project which seems to work:

        https://github.com/iclems/iOS-htmltopdf

Objective-C interfacing to C++ is challenging.

Thanks in advance for any tips,

-Ed
This email and any files transmitted with it from The Charles Machine Works, 
Inc. are confidential and intended solely for the use of the individual or 
entity to which they are addressed. If you have received this email in error 
please notify the sender. Our company accepts no liability for the contents of 
this email, or for the consequences of any actions taken on the basis of the 
information provided, unless that information is subsequently confirmed in 
writing. Please note that any views or opinions presented in this email are 
solely those of the author and do not necessarily represent those of the 
company. Finally, the recipient should check this email and any attachments for 
the presence of viruses. The company accepts no liability for any damage caused 
by any virus transmitted by this email.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to