Unplanned
Last Updated: 27 May 2022 06:33 by ADMIN
Simeon
Created on: 27 Sep 2021 08:32
Category: PDFViewer
Type: Bug Report
1
PdfViewer: Some Image XObjects are imported but not displayed in PdfViewer
Some Image XObjects are imported but not displayed in PdfViewer.

It seems all the documents contain scanned images produced by a Lexmark scanner.
4 comments
ADMIN
Dimitar
Posted on: 27 May 2022 06:33

Hi Bouly,

Would it be possible to send me the file after the script is executed on it so I can compare it with the original as well? 

Thank you in advance for your patience and cooperation. 

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

bouly
Posted on: 26 May 2022 10:48

Hi Dimitar,

 

Please, to refer Ticket ID: 1565786 and i 've added a sample file.

 

Attached Files:
ADMIN
Dimitar
Posted on: 26 May 2022 07:11

Hello Bouly,

Without having a file at hand to test this I cannot suggest a way to detect if the file cannot be opened. Since this is a public thread I would suggest opening a new ticket for this and attaching the file that is not correctly opened. This way we can properly investigate the case and confirm that indeed this is the issue with the specific file. We will be able to determine if there is a way to detect this issue as well. 

A general way to handle such documents is to use the Exception Handling mechanism.

Thank you in advance for your patience and cooperation. 

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

bouly
Posted on: 20 May 2022 10:25

To resolve this, I used ghostscript/gswin64c

I add ghoscript portable application in my project and transform the file before viewing it.

My problem, I need a way to dectect the trouble before transform the file.

 

From the web

@echo off
setlocal EnableDelayedExpansion

rem ghostscript executable name
set "ghostscript=gswin64"

rem directories to scan for files
set "filesDir[0]=D:\Partages\SMPLA\Gravette\Documents\LPM\LPM"
rem set "filesDir[1]=FOLDER2"
rem set "filesDir[2]=FOLDER3"

rem extension of files to be scanned
set "ext=pdf"

rem new file be creation or input file overwrite
set "createNewPDFs=0"
rem file prefix for new files (if they should be created)
set "filepre=compr_"

rem loop over all directories defined in filesDir array
for /f "tokens=2 delims==" %%d in ('set filesDir[') do (
   if exist "%%~d" (
      pushd "%%~d"
      rem loop over all files in all (sub)directories with given extension
      for /f "delims=*" %%f in ('dir "*.%ext%" /b /s /a:-d') do (
         if [%createNewPDFs%] EQU [1] (
            %ghostscript% -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile="%%~dpf%filepre%%%~nxf" "%%~f"
         ) else (
            %ghostscript% -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile="%TEMP%\%%~nxf" "%%~f"
        
    copy "%%~f" "%%~f.old"
    move /y "%TEMP%\%%~nxf" "%%~f"
         )

      )
      popd
   )
)