PDF Creation size XP vs Win 8.1u1

PDF Creation size XP vs Win 8.1u1

Postby TimStone » Thu Jun 12, 2014 11:32 pm

This is a "brainstorming" question. In fact, my brain feels like it is having a thunderstorm just thinking about it.

Consider there are two computers. One is an XP computer running 1 GB of RAM. The other runs Windows 8.1 update 1 and 8 GB of RAM.
The exact same program is run on both computers. The exact same data files are available on both computers. All application software settings are exactly the same. All application files ( .dlls, .exes, .dbf and .fpt files) are exactly the same !

A report is created in View mode ( rPreview ). The option is selected to send the report as a PDF via email. The report is 4 pages long.
The XP creates a 2 MB PDF and sends it.
The Window 8.1 creates an identical PDF but it is only 215 KB.

Why ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: PDF Creation size XP vs Win 8.1u1

Postby James Bott » Fri Jun 13, 2014 12:22 am

Are you using different PDF print drivers on the different PCs?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: PDF Creation size XP vs Win 8.1u1

Postby nageswaragunupudi » Fri Jun 13, 2014 6:31 am

Mr Tim

If you have Microsoft Word latest version, with PDF plugin installed on the PC, RPreview uses MicroSoft Words capabilities to create the PDF. Actially, a Word Document is created with the EMF files and saved as PDF using Word's Save method. Such PDF files are small.

If such a version with PDF plugin is not found FWH uses its own conversion to PDF. These PDF files are large.

FWH's built-in function serves the purpose but does not match high-end or dedicated products in speed, quality or size-optimization. If for a project, generation of PDFs is required on large scale, it is desirable that we may use special libraries like emf2pdf, etc.

This must be the difference.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10622
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: PDF Creation size XP vs Win 8.1u1

Postby TimStone » Fri Jun 13, 2014 5:23 pm

Thanks for the explanation. I do have Office 2013 installed on my computer. I didn't realize that FWH would automatically detect and use it.

I'm sure my client does not have that.

I've had PDF for a long time using Image2PDF.

I wonder if this could relate to why my client's email issue worked fine in the past ( when I used the Image2PDF ), but not now that I use the rPreview default.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: PDF Creation size XP vs Win 8.1u1

Postby nageswaragunupudi » Fri Jun 13, 2014 9:00 pm

I didn't realize that FWH would automatically detect and use it.

Yes, it does. When we have a wonderful PDF generator already available on the PC, why not use it?

I wonder if this could relate to why my client's email issue worked fine in the past ( when I used the Image2PDF ), but not now that I use the rPreview default.

If you can use image2pdf, then that is still the best option.
We provided FWH's own function as the last resort. It is not worthwhile for all programs to spend on priced libraries or we are not sure all PCs have Word 2003 with PDF plugin.

FWH's function had the xb_grab() problem earlier, but with the help and feedback from our friends, I thought we solved the issue fully a few versions back. Now that you are still experiencing the problem, it seems we need to put this function to stress-test at our end both on xHarbour/Harbour.

Meanwhile I suggest increasing the memory-swap area size on XP and try.

Note: If you want to use your own function to generate PDF, eg using Image2PDF, please include this statement at the beginning of your project. ( In the main function )

Code: Select all  Expand view
TPreview():bSaveToPDF := { |oPreview, cPDF, lView| MySaveAsPDF( oPreview, cPDF, lView ) }


cPDF and lView may be nil.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10622
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: PDF Creation size XP vs Win 8.1u1

Postby TimStone » Fri Jun 13, 2014 9:41 pm

I needed to use a modified rPreview anyway to support my email options. I simply have a user set flag that allows them to use Image2PDF ( which I do have a license for and it's already on their computers ). In the SendEMail( ) option, I simply redirect the PDF build to the alternate method, and then attach it to the email. My email system is also different because I need to support SMTP, CDO ( SSL ), and MAPI.

Now if I could specify in the Main( ) program an alternative to the SendEMail method contained in rpreview ( as your were doing with the PDF ), then it would be great because I could then use the rpreview without modification. Here is what I have for the SendMail( ) method now:

Code: Select all  Expand view

METHOD SendEmail() CLASS TPreview

   local oMail, cName, cFile, cSendTo, aInfo

   IF lUseOldXP
    PrevEmail( ::oDevice:aMeta )
   ELSE
       cSendTo := IIF( ! EMPTY( cDefEml), cDefEml, SPACE(100) )
       cName := If( ::oReport != nil, ::oReport:cName, ::oDevice:cDocument )
   
       cFile := cFilePath( ::oDevice:aMeta[ 1 ] ) + StrTran( cName, '.', '' ) + ;
                Left( HB_TToS( HB_DateTime() ), 14 ) + ".pdf"
   
       CursorWait()
       cFile := ::SaveAs( .t., cFile, .f. )   // This is the problem area
       CursorArrow()
   
       if ! File( cFile )
          MsgInfo( FWString( "PDF not saved to send Email" ), FWString( "Information" ) )
       elseif ::bEmail != nil
          Eval( ::bEmail, Self, cName, cFile )
       else
        ASWemail( cSendTo, cFile, cName )
          /*
          DEFINE MAIL oMail ;
             SUBJECT cName ;
             TEXT "" ;
             FILES cFile, cFile ;
             FROM USER
   
          ACTIVATE MAIL oMail
          // MsgInfo( oMail:nRetCode )  check the returned code!
          */

       endif
   ENDIF
   
   ::oMeta1:SetFocus()
   SysRefresh( )
   */
return nil
 


PrevEmail is a simple function build a PDF:

Code: Select all  Expand view

FUNCTION PrevEmail( aFiles )

    LOCAL cWhoTo := SPACE(255), cFileToSend

    // Create the PDF to attach to the file
    cFileToSend := BuildPDF( aFiles )
    cSubject := "Your requested report"

    // Now do the transmission
    ASWemail( cWhoto, cFileToSend, cSubject )

RETURN NIL

 


And BuildPDF is the code for Image2PDF.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: PDF Creation size XP vs Win 8.1u1

Postby nageswaragunupudi » Sat Jun 14, 2014 2:30 am

At the start of the main program please include these lines:
Code: Select all  Expand view

if lUsingImage2PDF
   TPreview():bSaveToPDF := { |oPreview, cPDF, lView| MySaveAsPDF( oPreview, cPDF, lView ) }
endif
TPreview():bMail := { |oPreview, cName, cPDF| MySendMail( oPreview, cName, cPDF )


Now you have these public functions anywhere:

Code: Select all  Expand view
function MySaveAsPDF( oPreview, cPDF, lView )

/*
  cPDF:  Repreview provices a file name. You may override if you like.
  Create cPDF with your favourite tool from oPreview:aMeta
 
  lView: If .t., display the PDF. If .f. do nothing. If nil, you decide whether or not to display. When rpreview calls this function from method SendMail(), this is always false.

  Return: cPDF ( file name with path created by this function ) // IMPORTANT
              If the function fails, please return nil

*/


return cPDF  // Important: Please return here the PDF file name with path created
                   // returning nil indicates failure

function MySendMail( oPreview, cName, cPDF )
/*

  oPreview: you may ignore.
  cName: Subject of the email suggested by Rpreview. You may ignore and have your own subject if you like.
  cPDF:  This is the PDF file name with path to attach. This is the same file name returned by MySaveAsPDF() function.

  Use your mail program to send  the mail attaching cPDF


*/



return lSuccess // rpreview does not use this return value
 


In case you want to use your own mail program to send PDF file, but want to use RPreivew's built in functionality to generate PDF (i.e. using MSWord, if available and fwh's own method otherwise) then speify only TPreview():bMail but not TPReview():bSaveAsPDF.

Here I try to plugin your functions:
Code: Select all  Expand view
if lUsingImage2PDF
   TPreview():bSaveToPDF := { |oPreview, cPDF, lView| BuildPDF( oPreview:aMeta ) }
endif
TPreview():bMail := { |oPreview, cName, cPDF| ASWemail( Space(255), cPDF, "Your Requested Report" ) }
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10622
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 36 guests