Skysnake

Start /max PDF - very slow problem

13 posts in this topic

I need help.

I have a project that outputs reports to PDF using @mLipok's lovely QuickPDF.  The PDF is created with no problem and I am sure the problem is not there.

However, I then have to open the PDF so the user can see it.

I use (a) short file name and (b) object properties

$oQP.SetPageLayout(2)
$oQP.SetPageMode(3)

... $sFilename ; as created by UDF
Local $sShortname = FileGetShortname( sFilename , 1 )

Run( @ComSpec & " /c start /max " & sShortname, "", @SW_HIDE ) ; force default PDF reader to open PDF maximized

Then the RUN should open it with the default application.

I have tested extensively on 32 bit Win7 and 64 bit Win10.  Works.

However, 64 bit Win8 and another Win7 laptop gives a problem.

The problem is this: when (typically) Adobe Reader is ALREADY open, the PDF opens almost instantaneously.  If the Reader is not open, it seems to stall.  Never opens.

The host on which the report will be opened is unknown to me and the PDF reader can not be hard coded.

Right now, my only brutal, very un-stylish solution is to force the Reader open prior to the RUN command.

Any ideas or advice on what causes this or how it could be remedied would be greatly appreciated.

Anything, please.

-Skysnake


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi.

I will try to Look when I back home.

Edit : today.

Edited by mLipok

NEW:     ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button:

Spoiler

Last update: 2016-11-12
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft Components * TeamViewer API -UDF * JavaManagement UDF * VIES over SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF *

My contribution to others projects: * _sql.au3 UDF  *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, The Art of Computer Programming
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

 

Share this post


Link to post
Share on other sites

Would ShellExecute work?

I've seen similar issues when different PDF readers have been installed one after the other, e.g. Foxit then Adobe. The registry isn't correctly updated in some cases.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Aha, that helps.

I just checked. The reason I use Run() is that ShellExecute used to fail... now both fail...

any suggestions on cleaning up the registry without becoming too invasive?

Thx 

-Skysnake


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

NEW:     ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button:

Spoiler

Last update: 2016-11-12
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft Components * TeamViewer API -UDF * JavaManagement UDF * VIES over SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF *

My contribution to others projects: * _sql.au3 UDF  *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, The Art of Computer Programming
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Dear @mLipok, I understand. But I would prefer to use local resources. create the PDF and then get (whatever is installed locally) to open the PDF... :)

I do not have control over the hardware this will be installed and want to make the use as easy as possible.

So, I guess I am looking at some kind of "do you want to fix the reader problem" option...

 

Meanwhile...

Some feedback... is it possible that Reader 9 and Reader 11 work differently?

Or, could MacAfee interfere with the file open? I know MacAfee has been in contention here before and I hate it... :(

 

-Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites
43 minutes ago, Skysnake said:

any suggestions on cleaning up the registry without becoming too invasive?

if it's not your machine, then don't go there. not your responsibility and you will probably do more harm than good.

have you considered the possibility that no PDF viewer is installed at all on the target machine?

i'd advise either choose an alternative, more trivial format, like HTML or XPS. if you insist on PDF, i'd advise you bundle your software with a free portable PDF viewer (pick one from this list), and use it specifically to display your PDF documents, and yours only.

Share this post


Link to post
Share on other sites

Hmm, thx @orbs, similar solution to what @mLipok suggested. I will certainly look at that.  Bundling will make the distribution bigger, but does solve this kind of silly "I cant see my reports" problem... Thx

-Skysnake


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

@Skysnake, if you are considering the Adobe Reader ActiveX control, then it may solve the slowness issue, but will not work when Adobe Reader is not installed.

Share this post


Link to post
Share on other sites

#10 ·  Posted

I can now add that I have seen the process stalled in the Task Manager.  

I do understand if there is no reader installed nothing will work, point taken... But then the user can install a reader of choice... perhaps a "testForReader()" function?  

Somewhere I read a reference to "recently created files..." -> why would this be an issue and could this be related to the problem I am experiencing?

-Skysnake


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Hi, you could check the file association and get the executable.

If the executable is Adobe Reader you can start it direct with the command line option /n. That means Reader will start the file in a new instance.

If you find another PDF viewer you can start it also direct. If you find nothing you can give a hint or a link to a PDF viewer.

 

br, Reinhard

 

PS.: In cmd you can use "assoc .pdf" and then use the result in "ftype ....." to get the program, but I think I saw also examples here.

Edited by ReFran
1 person likes this

Share this post


Link to post
Share on other sites

#12 ·  Posted

@Skysnake Why dont you use Internet Explorer to display the pdf  ?

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

9 hours ago, PACaleala said:

@Skysnake Why dont you use Internet Explorer to display the pdf  ?

This solution still will require AdobeReader.
So in case when you have AdobeReader the best option will be to embed Acrobat with my UDF.
 

@Skysnake try this concept:

....
#include "AcrobatReaderViewer.au3"
....

If  _AcrobatReader_IsInstaled() Then
    ; use
    _Acrobat_Show($sPDF_FileFullPath)
ElseIf .... Then
    ; try other options just ShellExecute ....
Else
    ; Ultimately it may not be any possibility to view the document.
EndIf
....
Func _AcrobatReader_IsInstaled()
    Local $oTemp = ObjCreate("AcroPDF.PDF.1")
    If @error Then Return False
    $oTemp = Null
    Return True
EndFunc
....

 

Edited by mLipok

NEW:     ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button:

Spoiler

Last update: 2016-11-12
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft Components * TeamViewer API -UDF * JavaManagement UDF * VIES over SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF *

My contribution to others projects: * _sql.au3 UDF  *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, The Art of Computer Programming
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • WoodGrain
      Run() executes on some computers but not others
      By WoodGrain
      Hi All,
      I've got a script setup to drop a program into a temp folder and then run it from there, but I have mixed results, the Run() command will work on some computers but not others. The file will be placed into the temp folder in all cases. Running AutoIT 3.3.14.0. The computers are all either Win 7 or 8.1, x64 (exe is compiled to x64 too), UAC is off, all have local admin rights - if I've missed something ask and I'll update the details.
      If Not FileExists (@TempDir & "\HCTB") Then DirCreate(@TempDir & "\HCTB") FileInstall("G:\IT\Downloads\TB\12.0.45471\Host\TB_Setup-sif7r8pgcq.exe", @TempDir & "\HCTB\TB_Setup-sif7r8pgcq.exe", 1) Local $iPID = Run(@TempDir & "\HCTB\TB_Setup-sif7r8pgcq.exe", "") Any suggestions?
      Thanks!
    • mLipok
      Debenu Quick PDF Library - UDF
      By mLipok
      I would like to present, the UDF for Debenu Quick PDF Library
      Getting Started:
      http://www.debenu.com/products/development/debenu-pdf-library/getting-started/getting-started-activex-edition/
      Function Reference:
      http://www.debenu.com/docs/pdf_library_reference/FunctionGroups.php
      Useful information:
      http://www.quickpdf.org/forum/quickpdf-the-first-steps_topic1242.html
      http://www.quickpdflibrary.com/blog/2011/02/the-basics-getting-familiar-with-quick-pdf-library/
      First time installing Debenu Quick PDF Library:
      You can download demo here:
      http://www.quickpdflibrary.com/downloads/quick_pdf_library_demo.exe
      Requirements:
      file "DebenuPDFLibraryLite1012.dll" or "DebenuPDFLibraryAX1014.dll" must be in @ScriptDir

      if you want to try you must download it from here:
      http://www.debenu.com/products/development/debenu-pdf-library/trial/
      or
      http://www.debenu.com/products/development/debenu-pdf-library-lite/free/
      after install you can find this dll in:
      "c:\Program Files (x86)\DebenuPDF Library\ActiveX\DebenuPDFLibraryAX1014.dll"
      or
      "c:\Program Files (x86)\DebenuPDF Library\Lite\DebenuPDFLibraryLite1012.dll"

      !!! you can change DLL to newer version using _QPDF_NewLibraryPath_Commercial()

      EDIT: actualy (19-06-2015) there is DebenuPDFLibraryAX1115.dll and DebenuPDFLibraryLite1115.dll
        to use the commercial version you need to use the _QPdf_SetLicenseKey() AutoIt 3.3.10.2++ For UDF and examples download, and the current version information please go to download section:

       
      The following information are outdated
    • mLipok
      Debenu Quick PDF Library - UDF
      By mLipok
      ; #INDEX# =======================================================================================================================
      ; Title .........: UDF for "Debenu Quick PDF Library"
      ; AutoIt Version : 3.3.10.2++
      ; Language ......: English
      ; Description ...: A collection of functions for Debenu Quick PDF Library
      ; Author(s) .....: mLipok
      ; Modified ......:
      ; ===============================================================================================================================
      Release note:
       
       
      Erratum v0.7:
       
      Forum link:

       
       
    • mLipok
      Debenu - QuickPDF - "The device context handle" question
      By mLipok
      I would ask for an indication of what is "The device context handle" in AutoIt.
       
      Below a handful of knowledge and examples, which, unfortunately, not quite speak to me (which is why I ask for help in clarifying their meaning).
       
      http://www.debenu.com/docs/pdf_library_reference/RenderPageToDC.php
       
       
      and C++ example:
      http://www.quickpdflibrary.com/faq/can-i-use-quick-pdf-as-a-viewer-in-my-c-application.php
      HWND m_hwnd = HWND(GDK_WINDOW_HWND(this->m_drawingArea.get_window()>gobj() )); HDC m_hdc = GetDC(m_hwnd); QP.RenderPageToDC(100, 1,(int)(HDC) m_hdc);
    • XuxinhaKill
      How can I stop any function that is running and restart main function?
      By XuxinhaKill
      How can I stop any function that is running and restart main function?
      My program keeps stacking points to go back, isn't it? How can I fix it?


      HotKeySet("{F8}", "StartStop") HotKeySet("{ESC}", "Quit") Global $status = -1, $cont Tray() Main() Func Main() $cont = 0 While 1 If $status = 1 Then Cont100() Switch TrayGetMsg() Case $ExitTray Exit Case $OptionsTray MsgBox(0, "Options", "Options") EndSwitch WEnd EndFunc Func Cont100() While $cont < 100 SplashTextOn("", $cont+1, 100, 50, 0, 0) $cont += 1 Sleep(1000) WEnd EndFunc Func Tray() Opt("TrayMenuMode",1) Global $OptionsTray = TrayCreateItem("Options") Global $ExitTray = TrayCreateItem("Exit") TraySetToolTip("NeoBux Bot - By FiMo") EndFunc Func StartStop() $status *= -1 Main() EndFunc Func Quit() Exit EndFunc