จัด PDF แบบเชิงเส้น
จัดลำดับไฟล์ใหม่ให้หน้าแรกแสดงก่อนที่ส่วนที่เหลือจะมาถึง
เครื่องมือนี้ทำงานในเบราว์เซอร์ของคุณทั้งหมด ไฟล์ของคุณไม่ถูกอัปโหลดเลย และคุณตรวจสอบได้เองในแท็บเครือข่ายของเบราว์เซอร์ ตรวจสอบด้วยตัวเอง เปิดแท็บเครือข่ายของเบราว์เซอร์แล้วดู คุณจะเห็นคำขอเล็ก ๆ หนึ่งรายการที่ถามว่าคุณยังมีโควตางานเหลืออยู่หรือไม่ ซึ่งมีแค่ชื่อเครื่องมือกับค่าแฮช ไม่ใช่ตัวไฟล์
เครื่องมือนี้ทำอะไร
A linearised PDF is the same document with its objects in a different order. Everything the first page needs is moved to the front of the file, so a reader can draw page one while the remaining megabytes are still arriving. Nothing about the pages, the text or the images changes - open the result next to the original and you will not be able to tell them apart on screen.
Do it to any PDF you publish on a website, link to in an email, or hand to a viewer embedded in an app. It matters most for large files on slow connections, where a document that opens in two seconds and one that appears to hang for thirty are the same file in two different orders.
วิธีทำงาน
- Drop the PDF onto this page. Files up to 300 MB are accepted.
- Leave Also repack the file on. It recompresses the streams first, which usually takes another 10 to 25 per cent off the size.
- Press Linearize.
- The download starts on its own, with a -web suffix so you can tell the two versions apart.
- Upload the result as it is. No setting is needed to produce the effect, though your server must support byte-range requests for readers to use it.
The mechanism is ordering, not compression. In an ordinary PDF the objects sit wherever the producer wrote them and the index that finds them is at the end, so a reader over HTTP either waits for the whole file or asks for pieces of it in several round trips. Linearising puts a small hint table, the first page and every object that page depends on right at the front, followed by the rest in page order.
Repacking and linearising pull against each other, which is why the order of the passes matters. Object streams make a file smaller by packing many objects into one compressed block, and linearisation needs the first page's objects reachable on their own. The repack runs first and the linearisation last, so qpdf resolves the conflict rather than producing a file that claims to be linearised and is not.
The effect only exists if the server cooperates. Fast Web View depends on HTTP byte-range requests: the reader asks for the first part of the file, draws page one, then asks for more. A server that does not honour ranges sends the whole file regardless, and the linearised document behaves like the ordinary one. Most static hosting and every CDN supports ranges; some application frameworks streaming a file through their own handler do not.
If the repack fails on an unusual file, you still get the linearisation you asked for. Recompression is treated as a bonus rather than a requirement.
The job happens in your browser through qpdf compiled to WebAssembly, so the file you are preparing to publish - often still a draft - reaches no server before you put it on one.
สิ่งที่เครื่องมือนี้ทำไม่ได้
- The benefit only appears when the file is served over HTTP by a server that supports byte-range requests. Opening a linearised file from disk is no faster.
คำถามที่คนมักถาม
- การจัดแบบเชิงเส้นทำอะไรกับไฟล์บ้าง
- มันเขียนเนื้อหาเดิมใหม่ในลำดับที่ต่างออกไป ตารางคำใบ้และทุกอย่างที่หน้าแรกต้องใช้จะถูกย้ายไปไว้ต้นไฟล์ ส่วนที่เหลือตามมาตามลำดับหน้า ไม่มีหน้า ภาพ หรือตัวอักษรใดเปลี่ยนไป ไฟล์มักใหญ่กว่าเวอร์ชันที่บีบอัดเต็มที่เล็กน้อย เพราะอ็อบเจกต์บางส่วนไม่สามารถอยู่ในบล็อกที่บีบอัดร่วมกันได้อีก
- ไฟล์ที่ส่งทางอีเมลอย่างเดียวจำเป็นต้องใช้หรือไม่
- ไม่ Fast Web View ช่วยได้เฉพาะเมื่อโปรแกรมอ่านดึงเอกสารผ่าน HTTP ทีละส่วน ไฟล์แนบจะถูกดาวน์โหลดจนครบก่อนเปิด การจัดแบบเชิงเส้นจึงไม่เปลี่ยนอะไรเลย ใช้กับไฟล์ที่คุณโฮสต์ ฝัง หรือทำลิงก์ไว้
- ไฟล์จะใหญ่ขึ้นหรือเล็กลง
- มีทั้งสองผลพร้อมกัน การจัดแบบเชิงเส้นเพิ่มตารางคำใบ้และทำให้อ็อบเจกต์บางส่วนถูกบีบอัดรวมกันไม่ได้ ซึ่งกินพื้นที่เพิ่มเล็กน้อย ส่วนการจัดเรียงใหม่ที่เลือกเปิดได้จะบีบอัดทุกสตรีมใหม่ ซึ่งมักประหยัดได้ 10 ถึง 25 เปอร์เซ็นต์ในไฟล์ที่ยังไม่เคยปรับแต่ง เมื่อเปิดการจัดเรียงใหม่ ผลลัพธ์มักเล็กกว่าไฟล์ที่คุณเริ่มต้น
- จะยืนยันได้อย่างไรว่าไฟล์ถูกจัดแบบเชิงเส้นแล้ว
- เปิดผลลัพธ์ใน Acrobat แล้วดูคุณสมบัติเอกสาร ช่อง Fast Web View จะแสดงว่า Yes ส่วนบนบรรทัดคำสั่ง qpdf --check จะรายงานว่าไฟล์ถูกจัดแบบเชิงเส้นแล้ว หากต้องการทดสอบผลจริง คุณยังต้องให้บริการไฟล์ผ่าน HTTP จากเซิร์ฟเวอร์ที่รองรับคำขอแบบช่วงด้วย
- ไฟล์ถูกอัปโหลดไปที่ใดหรือไม่
- ไม่ qpdf ทำงานเป็น WebAssembly ใน Web Worker ภายในเบราว์เซอร์ของคุณ เอกสารจึงอยู่บนอุปกรณ์ของคุณจนกว่าคุณจะเผยแพร่เอง หน้านี้ยังใช้งานได้โดยไม่ต้องเชื่อมต่ออินเทอร์เน็ตเมื่อโหลดเสร็จแล้ว