The official แคตาล็อกฟีเจอร์ของ Doconut lists browser printing and PDF export as viewer capabilities. Controlling access to them still requires two separate decisions: whether Doconut presents the relevant action and whether the host application authorizes that operation for the current user and document.

For the exact controls supported by your installed build, start with the Doconut documentation and the packaged samples available from the official Doconut download page. Do not copy configuration keys or source code from an unrelated version or an unverified article.
1. กำหนดนโยบายการพิมพ์ก่อน
Write down who may print and under which conditions before changing the toolbar. A useful policy answers questions such as:
- การพิมพ์อนุญาตให้ทุกตัวดู, เฉพาะบางบทบาท, หรือเอกสารเฉพาะหรือไม่?
- การตัดสินใจขึ้นอยู่กับผู้เช่า, สถานะคดี, การจัดประเภทเอกสาร, หรือวันหมดอายุหรือไม่?
- จำเป็นต้องมีลายน้ำบนผลลัพธ์ที่พิมพ์หรือไม่?
- ควรบันทึกเหตุการณ์การพิมพ์หรือไม่?
- ผู้ใช้สามารถพิมพ์ฉบับแก้ไขเก่าของเอกสารได้หรือไม่?
- ควรทำอย่างไรเมื่อสิทธิ์เปลี่ยนแปลงขณะการแสดงตัวอย่างเปิดอยู่?
Avoid a single global Boolean when the real rule is contextual. Model printing as its own operation so it can be authorized independently from viewing and downloading.
2. แยกสถานะ UI ออกจากการอนุญาต
The host page can decide whether to present a print control after it receives an application-owned permission result. That improves clarity for users who cannot print.
However, hiding a control is not an authorization boundary. A user can still call a known endpoint directly, replay an earlier request, or invoke browser printing on visible content. Every server route that produces printable output must enforce the same policy.
Use distinct states in the UI:
| สถานะ | พฤติกรรมของตัวดู | พฤติกรรมของเซิร์ฟเวอร์ |
|---|---|---|
| อนุญาตการพิมพ์ | แสดงการกระทำการพิมพ์ที่รองรับ | อนุญาตและสร้างผลลัพธ์ที่ร้องขอ |
| การพิมพ์ถูกปฏิเสธ | ซ่อนหรือปิดการทำงานของการกระทำพร้อมคำอธิบายที่ชัดเจน | ส่งคืนการตอบสนองที่ห้ามเข้าถึง |
| นโยบายไม่ทราบ | รักษาการกระทำให้ไม่พร้อมใช้งานขณะกำลังโหลดสิทธิ์ | ไม่สร้างผลลัพธ์ |
| เซสชันหมดอายุ | ขอให้ผู้ใช้ทำการยืนยันตัวตนใหม่ | ปฏิเสธคำขอที่ล้าสมัย |
3. ปกป้องจุดสิ้นสุดการพิมพ์
Protect the application operation that invokes printing or returns printable output. The authorization decision should account for tenant membership, ownership, classification, workflow state, and document revision. Resolve the document on the server instead of accepting a client-supplied path or storage URL.
If your application prints through a viewer-specific route instead of creating a PDF, apply the same authorization before invoking that route.
4. กำหนดค่ารุ่นตัวดูที่ติดตั้ง
Once the server rule exists, configure the Doconut UI using the exact option documented for the package and sample files shipped with your version. The การสาธิตสดของ Doconut let you observe supported viewer behavior before you commit to a particular integration. Verify:
- Where the option is set: server configuration, view model, or client initialization.
- Whether it hides a toolbar item, disables an action, or affects generated output.
- Whether the value applies per viewer instance or globally.
- Whether print and export are separate operations.
- Whether an update changed the option name or default.
Treat the official sample as the source of truth. A plausible-looking property name is not enough evidence that the installed viewer recognizes it.
5. จัดการการพิมพ์ของเบราว์เซอร์อย่างตรงไปตรงมา
A viewer setting cannot guarantee that visible information will never be printed or captured. The browser may print the host page, and users can take screenshots or photographs. Keyboard interception and print-specific CSS can improve the expected experience, but they are bypassable client-side measures.
If the host page should not produce a useful paper copy, your application can use its own print-specific presentation to replace the preview with an explanatory message. Keep that host-page behavior separate from Doconut's documented viewer controls.
Do not describe this as document protection. Use server-side rendering, authorization, controlled exports, and visible watermarks when your risk assessment calls for stronger deterrence.
6. แยกการดาวน์โหลด การส่งออก และการพิมพ์ออกจากกัน
Users and developers often treat these as one “read-only” switch, but they represent different data flows:
- ดู แสดงเนื้อหาที่เรนเดอร์
- ดาวน์โหลด ส่งคืนแหล่งที่มาหรือไฟล์ที่จัดเก็บอื่น
- ส่งออก สร้างรูปแบบที่แยกออกมา
- พิมพ์ สร้างตัวแทนที่พิมพ์ได้หรือเรียกการพิมพ์ของเบราว์เซอร์
Authorize each operation explicitly. A user who cannot print may still be allowed to download, or the reverse. Your toolbar should reflect the server's decisions rather than define them.
7. เพิ่มเหตุการณ์ตรวจสอบที่มีประโยชน์
If printing is sensitive, record the decision without logging the document itself. An event can include the user, tenant, document identifier, revision, policy outcome, timestamp, and correlation ID.
Record both successful and denied attempts. If the print service creates a temporary file, also record whether its cleanup completed. Keep file paths, tokens, document titles containing personal data, and printable content out of routine logs.
8. ทดสอบนอกเหนือจากปุ่มที่หายไป
The toolbar is only the first assertion. Add tests for the whole operation:
ผู้ใช้ที่ได้รับอนุญาต
- การกระทำการพิมพ์ที่ตั้งใจปรากฏให้เห็น
- คำขอพิมพ์สำเร็จสำหรับเอกสารที่ได้รับอนุญาต
- ใช้การแก้ไขที่ถูกต้อง
- เครื่องหมายที่จำเป็นปรากฏบนผลลัพธ์ที่สร้าง
- เหตุการณ์ตรวจสอบบันทึกความสำเร็จ
ผู้ใช้ที่ไม่ได้รับอนุญาต
- การกระทำไม่มีหรือถูกปิดการทำงาน
- คำขอโดยตรงไปยังเส้นทางพิมพ์ส่งคืนการตอบสนองที่ห้ามเข้าถึง
- การเปลี่ยน ID ของเอกสารไม่ข้ามกฎ
- URL ที่คัดลอกจากเซสชันที่ได้รับอนุญาตไม่สามารถนำมาใช้ซ้ำโดยไม่เหมาะสม
- การปฏิเสธไม่ได้เปิดเผยว่าผู้เช่าอื่นเป็นเจ้าของเอกสารหรือไม่
การเปลี่ยนแปลงสถานะ
- สิทธิ์ที่ถูกยกเลิกระหว่างเซสชันจะถูกบังคับใช้ในการขอพิมพ์ครั้งต่อไป
- เซสชันที่หมดอายุไม่สามารถพิมพ์ได้
- เอกสารที่ถูกลบหรือทดแทนจะสร้างข้อผิดพลาดที่ควบคุมได้
- ผลลัพธ์การพิมพ์ชั่วคราวจะเป็นไปตามกฎการเก็บรักษาที่กำหนด
Browser automation can verify the visible state and response code. Integration tests should verify policy evaluation and document-level authorization independently.
คำถามที่พบบ่อย
Does hiding the print button stop the browser's print shortcut?
No. It removes an intended viewer action only if the installed viewer implements that behavior. Browser printing and screen capture require separate consideration and cannot be fully prevented by client-side code.
Should print permission be included in the viewing URL?
Prefer a server-side authorization decision tied to the authenticated user, document, and operation. If a temporary reference carries permissions, scope it narrowly, protect it from logs and referrers, and revalidate sensitive actions.
Is disabling print enough for confidential documents?
No. It is one usability or deterrence control. Confidential workflows also need storage protection, object-level authorization, controlled exports, retention rules, monitoring, and an accepted residual-risk model.
สรุป
A trustworthy Doconut print-control implementation starts at the server and ends in the interface. Define the policy, protect the operation, configure only the documented option for your installed viewer, explain the result to users, and test direct requests as well as toolbar visibility. Use the official feature page, documentation, downloads, and demos as the implementation sources rather than recreating product code in the article.