简体   繁体   中英

After read edit and write pdf ghostscript say about error

I read a pdf file and edit a color of text in him, after I replace the original stream with a new one and write all in new pdf. After i try to use a ghostscript to do a pdf a grayscale and he say about a error:

But new pdf file open without trouble in pdf viewer I use a zlib library to decompress and compress back a pdf streams

Error message from ghostscript

**** Error:  An error occurred while reading an XREF table.
   **** The file has been damaged.  This may have been caused
   **** by a problem while converting or transferring the file.
   **** Ghostscript will attempt to recover the data.
   **** However, the output may be incorrect.
Processing pages 1 through 1.
Page 1
   **** Error: stream Length incorrect.
               Output may be incorrect.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> PDFium <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

   **** The rendered output from this file may be incorrect.

You would need to alter the /Length in the stream dictionary. Then alter the offsets of every later object in the file in the XREF table or stream. Complicated stuff.

Run the file through cpdf or qpdf to do all that automatically, mending it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM