System.InvalidOperationException: Page object for page 22 is not in seven part

Hello,

I am working on a production support issue. We are using C# with Aspose.PDF (21.12.0). I do not have the file unfortunately. I realize that you cannot duplicate the issue without the PDF, but may I please know some common reasons for the “seven part” error? I do not understand what that means. Here is the scenario:

  1. The user uploads a file.
  2. We verify that the file is a content type of application/pdf.
  3. We move that pdf to a memory stream.
  4. An Aspose.Pdf.Document is instantiated with that memory stream.
  5. We combine multiple pdfs in that document if there are any more (in this case it was only the one pdf, so no combining happened).
  6. We use Aspose.Pdf.Document.Save to move the completed document to a new memory stream.

When we do that, this error below occurs:

System.InvalidOperationException: Page object for page 22 is not in seven part
at #=zHoaTOCkq7dclvMay_uG4ccKEa9ftMDGMZHUlUP_NDQRvN6bZWEQbcQF7BaKwKKP$PA==.#=zfSoITSNukNOC0RhPfDqWrZTK6Hej()
at #=zHoaTOCkq7dclvMay_uG4ccKEa9ftMDGMZHUlUP_NDQRvN6bZWEQbcQF7BaKwKKP$PA==.#=zTNOyPyABjlzE57$7Qw==(#=zFQaqi9q8MCPb$waCezRjeLHuXrgpNNJZ1tox87iRRhSp #=zjrphe$PmxtYU, Boolean #=zZoHtdja8DJL_)
at #=zHoaTOCkq7dclvMay_uG4ccKEa9ftMDGMZHUlUP_NDQRvN6bZWEQbcQF7BaKwKKP$PA==.#=z893tXRA=(#=zFQaqi9q8MCPb$waCezRjeLHuXrgpNNJZ1tox87iRRhSp #=zaPsPutxnsfwJ, Boolean #=zZoHtdja8DJL_)
at #=zHoaTOCkq7dclvMay_uG4ccKEa9ftMDGMZHUlUP_NDQRvN6bZWEQbcQF7BaKwKKP$PA==.#=zjR5Tyo8=(#=zFQaqi9q8MCPb$waCezRjeLHuXrgpNNJZ1tox87iRRhSp #=zjrphe$PmxtYU, #=z9gmOHSv2RJb$NnR4sIA4_J0HlvvHyK3G2WNoJsY= #=ztXiEVkM=)
at (Object , Object[] )
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zXQSP1wxCYrgzy3ULGcwXntWjBa43VCS8IKvJ6nA=(MethodBase #=znWxZeC0=, Object #=z0q$sHwg=, Object[] #=zx1hOoR8=, Boolean #=zDQZuDLg=)
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zcOMt1$BywVdYJE3Ujt5qKW$3LD6PY$UvVl5hwbM=(MethodBase #=znWxZeC0=, Boolean #=z0q$sHwg=)
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zYY75iDuR$1E8gxiiN1JALpS$5MTWoQIOJg==(#=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI= #=znWxZeC0=, #=qfTjkMLvhcrB7qxIOrZgPBNk_hKdLj9eQcG6djEAg8HU= #=z0q$sHwg=)
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=z63onGMbEV0HXUrC48hZr$HxSWsR6eDg25A==()
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zsjK_fV9uaEWWRq10faifSNFz3bXWXg65xw==(Boolean #=znWxZeC0=)
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zlSFtZF3LWTWDymgFL$Dmg2Dut09Kwwg4JvfrkDc=(Object #=znWxZeC0=)
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zar9iKCrjVfcTtHldpK3T4KoCC4A5VHJEWKWD1VEijAZi()
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zRwnJkxaXRO4$$qyMqxd_2dIlya5a(Object #=znWxZeC0=, UInt32 #=z0q$sHwg=)
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zsjK_fV9uaEWWRq10faifSNFz3bXWXg65xw==(Boolean #=znWxZeC0=)
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zB__sY1nnx$ESQCDkJcSG1TjkLydDAfB2oiy9kOQ=(Object[] #=znWxZeC0=, Type[] #=z0q$sHwg=, Type[] #=zx1hOoR8=, Object[] #=zDQZuDLg=)
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=z$pgZ5tp_J$X5EIpXGGHxKXLjuBazFwH9Jg==(Stream #=znWxZeC0=, String #=z0q$sHwg=, Object[] #=zx1hOoR8=)
at #=qcfljQivUJApbEjFoNUmIJZrVRINIisFMc9ncnhlLhVI=.#=zo_48T5IxlBNxPdRWmMB_CLissqoDV48HT2dZlso=(Stream #=znWxZeC0=, String #=z0q$sHwg=, Object[] #=zx1hOoR8=)
at #=zaY$W_eRLCUn8C2KtPiQV$bVTMNwCWOkaow==.#=zjR5Tyo8=()
at #=zDCMCmc4wZbmQDytmeOnMmHv7lQV57qDLzw==.#=zjR5Tyo8=(Stream #=zRtGho4o=)
at #=z8bUdn7NB3HniUI$5rsmHmMh_8aU3.#=zjR5Tyo8=(Stream #=zRtGho4o=)
at Aspose.Pdf.Document.#=zWpTMNTSWhKCW(Stream #=z39JYGBU=, SaveOptions #=z7E92puekiEfC)

@areinking

Looks like the issue is related to the linearization. Please check if IsLinearized flag is set in the code before saving the document. If it is set to true, please make it false and try again. In case issue still persists, we would need sample PDF in order to investigate the issue further. Also, please make sure to use 23.7 version of the API which is the latest and the recommended one.