Object XfdfFormatter

  • All Implemented Interfaces:

    
    public class XfdfFormatter
    
                        

    Provides methods for exporting data in XFDF format from the document as well as parsing the existing XFDF data and applying it to the document.

    • Constructor Detail

    • Method Detail

      • parseXfdfAsync

        @JvmOverloads() final static Single<List<Annotation>> parseXfdfAsync(PdfDocument document, DataProvider dataProvider, Boolean ignorePageRotation)

        Parses XFDF file served by the data provider and returns a list of annotations that can be added to the document. This doesn't automatically add all the annotations to the document. To do that use com.pspdfkit.annotations.AnnotationProvider.addAnnotationToPage.

        The returned completable will emit a XfdfFormatterException when encountering an unexpected error while importing the XFDF.

        Parameters:
        document - Document for which we're parsing XFDF file.
        dataProvider - Data provider serving the source XFDF file.
        ignorePageRotation - Whether to ignore page transform matrices (rotation and CropBox offset) when parsing.
        Returns:

        Single that finishes after the parsing is performed, either by returning array of parsed annotation in onSuccess(), or onError().

      • parseXfdfAsync

        @JvmOverloads() final static Single<List<Annotation>> parseXfdfAsync(PdfDocument document, DataProvider dataProvider)

        Parses XFDF file served by the data provider and returns a list of annotations that can be added to the document. This doesn't automatically add all the annotations to the document. To do that use com.pspdfkit.annotations.AnnotationProvider.addAnnotationToPage.

        The returned completable will emit a XfdfFormatterException when encountering an unexpected error while importing the XFDF.

        Parameters:
        document - Document for which we're parsing XFDF file.
        dataProvider - Data provider serving the source XFDF file.
        Returns:

        Single that finishes after the parsing is performed, either by returning array of parsed annotation in onSuccess(), or onError().

      • parseXfdf

        @JvmOverloads() final static List<Annotation> parseXfdf(PdfDocument document, DataProvider dataProvider, Boolean ignorePageRotation)

        Parses XFDF file served by the data provider and returns a list of annotations that can be added to the document. This doesn't automatically add all the annotations to the document. To do that use com.pspdfkit.annotations.AnnotationProvider.addAnnotationToPage.

        The method will throw a XfdfFormatterException when encountering an unexpected error while importing the XFDF.

        Warning: this method runs on the current thread. If the current thread is the UI thread, it's recommended that you offload it to some other one, because this operation can take some time and thus block the UI.

        Parameters:
        document - Document for which we're parsing XFDF file.
        dataProvider - Data provider serving the source XFDF file.
        ignorePageRotation - Whether to ignore page transform matrices (rotation and CropBox offset) when parsing.
        Returns:

        List of annotations parsed from the XFDF file, ready to be added to the document.

      • parseXfdf

        @JvmOverloads() final static List<Annotation> parseXfdf(PdfDocument document, DataProvider dataProvider)

        Parses XFDF file served by the data provider and returns a list of annotations that can be added to the document. This doesn't automatically add all the annotations to the document. To do that use com.pspdfkit.annotations.AnnotationProvider.addAnnotationToPage.

        The method will throw a XfdfFormatterException when encountering an unexpected error while importing the XFDF.

        Warning: this method runs on the current thread. If the current thread is the UI thread, it's recommended that you offload it to some other one, because this operation can take some time and thus block the UI.

        Parameters:
        document - Document for which we're parsing XFDF file.
        dataProvider - Data provider serving the source XFDF file.
        Returns:

        List of annotations parsed from the XFDF file, ready to be added to the document.

      • writeXfdfAsync

        @JvmOverloads() final static Completable writeXfdfAsync(PdfDocument document, List<Annotation> annotations, List<FormField> formFields, OutputStream outputStream, Boolean ignorePageRotation)

        Generates an XFDF file out of provided annotations and form fields and writes the output to the given output stream.

        Parameters:
        document - Document containing given annotations and form fields.
        annotations - List of annotations to be parsed.
        formFields - List of form fields to be parsed, or null.
        outputStream - Output stream for writing the generated XFDF file.
        ignorePageRotation - Whether to ignore page transform matrices (rotation and CropBox offset) when parsing.
        Returns:

        Completable that finishes after the writing is performed, either by returning onComplete() or onError().

      • writeXfdfAsync

        @JvmOverloads() final static Completable writeXfdfAsync(PdfDocument document, List<Annotation> annotations, List<FormField> formFields, OutputStream outputStream)

        Generates an XFDF file out of provided annotations and form fields and writes the output to the given output stream.

        Parameters:
        document - Document containing given annotations and form fields.
        annotations - List of annotations to be parsed.
        formFields - List of form fields to be parsed, or null.
        outputStream - Output stream for writing the generated XFDF file.
        Returns:

        Completable that finishes after the writing is performed, either by returning onComplete() or onError().

      • writeXfdf

        @JvmOverloads() final static Unit writeXfdf(PdfDocument document, List<Annotation> annotations, List<FormField> formFields, OutputStream outputStream, Boolean ignorePageRotation)

        Generates an XFDF file out of provided annotations and form fields and writes the output to the given output stream.

        Warning: this method runs on the current thread. If the current thread is the UI thread, it's recommended that you offload it to some other one, because this operation can take some time and thus block the UI.

        Parameters:
        document - Document containing given annotations and form fields.
        annotations - List of annotations to be parsed.
        formFields - List of form fields to be parsed.
        outputStream - Output stream for writing the generated XFDF file.
        ignorePageRotation - Whether to ignore page transform matrices (rotation and CropBox offset) when parsing.
      • writeXfdf

        @JvmOverloads() final static Unit writeXfdf(PdfDocument document, List<Annotation> annotations, List<FormField> formFields, OutputStream outputStream)

        Generates an XFDF file out of provided annotations and form fields and writes the output to the given output stream.

        Warning: this method runs on the current thread. If the current thread is the UI thread, it's recommended that you offload it to some other one, because this operation can take some time and thus block the UI.

        Parameters:
        document - Document containing given annotations and form fields.
        annotations - List of annotations to be parsed.
        formFields - List of form fields to be parsed.
        outputStream - Output stream for writing the generated XFDF file.