Why my code not correctly split every page in a scanned pdf?

前端 未结 3 1437
旧时难觅i
旧时难觅i 2021-01-02 10:27

Update: Thanks to stardt whose script works! The pdf is a page of another one. I tried the script on the other one, and it also correctly spit each pdf page

3条回答
  •  误落风尘
    2021-01-02 10:52

    I'd like to add that you have to pay attention that your mediaBox variables are not shared across the copies p and q. This can easily happen if you read from p.mediaBox before taking the copy.

    In that case, writing to e.g. p.mediaBox.upperRight may modify q.mediaBox and vice versa.

    @moraes' solution takes care of this by explicitly copying the mediaBox.

提交回复
热议问题