|
92 | 92 | PdfRedactionApplyPayload, |
93 | 93 | PdfRedactionPreviewPayload, |
94 | 94 | PdfRestRawFileResponse, |
| 95 | + PdfRestrictPayload, |
95 | 96 | PdfSplitPayload, |
96 | 97 | PdfToExcelPayload, |
97 | 98 | PdfToPdfaPayload, |
98 | 99 | PdfToPdfxPayload, |
99 | 100 | PdfToPowerpointPayload, |
100 | 101 | PdfToWordPayload, |
| 102 | + PdfUnrestrictPayload, |
101 | 103 | PdfXfaToAcroformsPayload, |
102 | 104 | PngPdfRestPayload, |
103 | 105 | SummarizePdfTextPayload, |
|
120 | 122 | PdfMergeInput, |
121 | 123 | PdfPageSelection, |
122 | 124 | PdfRedactionInstruction, |
| 125 | + PdfRestriction, |
123 | 126 | PdfRGBColor, |
124 | 127 | PdfXType, |
125 | 128 | PngColorModel, |
@@ -2684,6 +2687,113 @@ def flatten_pdf_forms( |
2684 | 2687 | timeout=timeout, |
2685 | 2688 | ) |
2686 | 2689 |
|
| 2690 | + def add_permissions_password( |
| 2691 | + self, |
| 2692 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 2693 | + *, |
| 2694 | + new_permissions_password: str, |
| 2695 | + restrictions: Sequence[PdfRestriction] | None = None, |
| 2696 | + current_open_password: str | None = None, |
| 2697 | + output: str | None = None, |
| 2698 | + extra_query: Query | None = None, |
| 2699 | + extra_headers: AnyMapping | None = None, |
| 2700 | + extra_body: Body | None = None, |
| 2701 | + timeout: TimeoutTypes | None = None, |
| 2702 | + ) -> PdfRestFileBasedResponse: |
| 2703 | + """Add a permissions password and optional restrictions to a PDF.""" |
| 2704 | + |
| 2705 | + payload: dict[str, Any] = { |
| 2706 | + "files": file, |
| 2707 | + "new_permissions_password": new_permissions_password, |
| 2708 | + } |
| 2709 | + if restrictions is not None: |
| 2710 | + payload["restrictions"] = restrictions |
| 2711 | + if current_open_password is not None: |
| 2712 | + payload["current_open_password"] = current_open_password |
| 2713 | + if output is not None: |
| 2714 | + payload["output"] = output |
| 2715 | + |
| 2716 | + return self._post_file_operation( |
| 2717 | + endpoint="/restricted-pdf", |
| 2718 | + payload=payload, |
| 2719 | + payload_model=PdfRestrictPayload, |
| 2720 | + extra_query=extra_query, |
| 2721 | + extra_headers=extra_headers, |
| 2722 | + extra_body=extra_body, |
| 2723 | + timeout=timeout, |
| 2724 | + ) |
| 2725 | + |
| 2726 | + def change_permissions_password( |
| 2727 | + self, |
| 2728 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 2729 | + *, |
| 2730 | + current_permissions_password: str, |
| 2731 | + new_permissions_password: str, |
| 2732 | + restrictions: Sequence[PdfRestriction] | None = None, |
| 2733 | + current_open_password: str | None = None, |
| 2734 | + output: str | None = None, |
| 2735 | + extra_query: Query | None = None, |
| 2736 | + extra_headers: AnyMapping | None = None, |
| 2737 | + extra_body: Body | None = None, |
| 2738 | + timeout: TimeoutTypes | None = None, |
| 2739 | + ) -> PdfRestFileBasedResponse: |
| 2740 | + """Rotate the permissions password and optionally update restrictions.""" |
| 2741 | + |
| 2742 | + payload: dict[str, Any] = { |
| 2743 | + "files": file, |
| 2744 | + "current_permissions_password": current_permissions_password, |
| 2745 | + "new_permissions_password": new_permissions_password, |
| 2746 | + } |
| 2747 | + if restrictions is not None: |
| 2748 | + payload["restrictions"] = restrictions |
| 2749 | + if current_open_password is not None: |
| 2750 | + payload["current_open_password"] = current_open_password |
| 2751 | + if output is not None: |
| 2752 | + payload["output"] = output |
| 2753 | + |
| 2754 | + return self._post_file_operation( |
| 2755 | + endpoint="/restricted-pdf", |
| 2756 | + payload=payload, |
| 2757 | + payload_model=PdfRestrictPayload, |
| 2758 | + extra_query=extra_query, |
| 2759 | + extra_headers=extra_headers, |
| 2760 | + extra_body=extra_body, |
| 2761 | + timeout=timeout, |
| 2762 | + ) |
| 2763 | + |
| 2764 | + def remove_permissions_password( |
| 2765 | + self, |
| 2766 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 2767 | + *, |
| 2768 | + current_permissions_password: str, |
| 2769 | + current_open_password: str | None = None, |
| 2770 | + output: str | None = None, |
| 2771 | + extra_query: Query | None = None, |
| 2772 | + extra_headers: AnyMapping | None = None, |
| 2773 | + extra_body: Body | None = None, |
| 2774 | + timeout: TimeoutTypes | None = None, |
| 2775 | + ) -> PdfRestFileBasedResponse: |
| 2776 | + """Remove permissions restrictions from a PDF.""" |
| 2777 | + |
| 2778 | + payload: dict[str, Any] = { |
| 2779 | + "files": file, |
| 2780 | + "current_permissions_password": current_permissions_password, |
| 2781 | + } |
| 2782 | + if current_open_password is not None: |
| 2783 | + payload["current_open_password"] = current_open_password |
| 2784 | + if output is not None: |
| 2785 | + payload["output"] = output |
| 2786 | + |
| 2787 | + return self._post_file_operation( |
| 2788 | + endpoint="/unrestricted-pdf", |
| 2789 | + payload=payload, |
| 2790 | + payload_model=PdfUnrestrictPayload, |
| 2791 | + extra_query=extra_query, |
| 2792 | + extra_headers=extra_headers, |
| 2793 | + extra_body=extra_body, |
| 2794 | + timeout=timeout, |
| 2795 | + ) |
| 2796 | + |
2687 | 2797 | def compress_pdf( |
2688 | 2798 | self, |
2689 | 2799 | file: PdfRestFile | Sequence[PdfRestFile], |
@@ -3721,6 +3831,113 @@ async def flatten_pdf_forms( |
3721 | 3831 | timeout=timeout, |
3722 | 3832 | ) |
3723 | 3833 |
|
| 3834 | + async def add_permissions_password( |
| 3835 | + self, |
| 3836 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 3837 | + *, |
| 3838 | + new_permissions_password: str, |
| 3839 | + restrictions: Sequence[PdfRestriction] | None = None, |
| 3840 | + current_open_password: str | None = None, |
| 3841 | + output: str | None = None, |
| 3842 | + extra_query: Query | None = None, |
| 3843 | + extra_headers: AnyMapping | None = None, |
| 3844 | + extra_body: Body | None = None, |
| 3845 | + timeout: TimeoutTypes | None = None, |
| 3846 | + ) -> PdfRestFileBasedResponse: |
| 3847 | + """Asynchronously add a permissions password and optional restrictions to a PDF.""" |
| 3848 | + |
| 3849 | + payload: dict[str, Any] = { |
| 3850 | + "files": file, |
| 3851 | + "new_permissions_password": new_permissions_password, |
| 3852 | + } |
| 3853 | + if restrictions is not None: |
| 3854 | + payload["restrictions"] = restrictions |
| 3855 | + if current_open_password is not None: |
| 3856 | + payload["current_open_password"] = current_open_password |
| 3857 | + if output is not None: |
| 3858 | + payload["output"] = output |
| 3859 | + |
| 3860 | + return await self._post_file_operation( |
| 3861 | + endpoint="/restricted-pdf", |
| 3862 | + payload=payload, |
| 3863 | + payload_model=PdfRestrictPayload, |
| 3864 | + extra_query=extra_query, |
| 3865 | + extra_headers=extra_headers, |
| 3866 | + extra_body=extra_body, |
| 3867 | + timeout=timeout, |
| 3868 | + ) |
| 3869 | + |
| 3870 | + async def change_permissions_password( |
| 3871 | + self, |
| 3872 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 3873 | + *, |
| 3874 | + current_permissions_password: str, |
| 3875 | + new_permissions_password: str, |
| 3876 | + restrictions: Sequence[PdfRestriction] | None = None, |
| 3877 | + current_open_password: str | None = None, |
| 3878 | + output: str | None = None, |
| 3879 | + extra_query: Query | None = None, |
| 3880 | + extra_headers: AnyMapping | None = None, |
| 3881 | + extra_body: Body | None = None, |
| 3882 | + timeout: TimeoutTypes | None = None, |
| 3883 | + ) -> PdfRestFileBasedResponse: |
| 3884 | + """Asynchronously rotate the permissions password and optionally update restrictions.""" |
| 3885 | + |
| 3886 | + payload: dict[str, Any] = { |
| 3887 | + "files": file, |
| 3888 | + "current_permissions_password": current_permissions_password, |
| 3889 | + "new_permissions_password": new_permissions_password, |
| 3890 | + } |
| 3891 | + if restrictions is not None: |
| 3892 | + payload["restrictions"] = restrictions |
| 3893 | + if current_open_password is not None: |
| 3894 | + payload["current_open_password"] = current_open_password |
| 3895 | + if output is not None: |
| 3896 | + payload["output"] = output |
| 3897 | + |
| 3898 | + return await self._post_file_operation( |
| 3899 | + endpoint="/restricted-pdf", |
| 3900 | + payload=payload, |
| 3901 | + payload_model=PdfRestrictPayload, |
| 3902 | + extra_query=extra_query, |
| 3903 | + extra_headers=extra_headers, |
| 3904 | + extra_body=extra_body, |
| 3905 | + timeout=timeout, |
| 3906 | + ) |
| 3907 | + |
| 3908 | + async def remove_permissions_password( |
| 3909 | + self, |
| 3910 | + file: PdfRestFile | Sequence[PdfRestFile], |
| 3911 | + *, |
| 3912 | + current_permissions_password: str, |
| 3913 | + current_open_password: str | None = None, |
| 3914 | + output: str | None = None, |
| 3915 | + extra_query: Query | None = None, |
| 3916 | + extra_headers: AnyMapping | None = None, |
| 3917 | + extra_body: Body | None = None, |
| 3918 | + timeout: TimeoutTypes | None = None, |
| 3919 | + ) -> PdfRestFileBasedResponse: |
| 3920 | + """Asynchronously remove permissions restrictions from a PDF.""" |
| 3921 | + |
| 3922 | + payload: dict[str, Any] = { |
| 3923 | + "files": file, |
| 3924 | + "current_permissions_password": current_permissions_password, |
| 3925 | + } |
| 3926 | + if current_open_password is not None: |
| 3927 | + payload["current_open_password"] = current_open_password |
| 3928 | + if output is not None: |
| 3929 | + payload["output"] = output |
| 3930 | + |
| 3931 | + return await self._post_file_operation( |
| 3932 | + endpoint="/unrestricted-pdf", |
| 3933 | + payload=payload, |
| 3934 | + payload_model=PdfUnrestrictPayload, |
| 3935 | + extra_query=extra_query, |
| 3936 | + extra_headers=extra_headers, |
| 3937 | + extra_body=extra_body, |
| 3938 | + timeout=timeout, |
| 3939 | + ) |
| 3940 | + |
3724 | 3941 | async def compress_pdf( |
3725 | 3942 | self, |
3726 | 3943 | file: PdfRestFile | Sequence[PdfRestFile], |
|
0 commit comments