Print.printToFileAsync with embedded pdf only shows 1st pdf page

Please provide the following:

  1. SDK Version: 38.0.9
  2. Platforms(Android/iOS/web/all): iOS

In the following code, I’m downloading a pdf from a url. If I look at the pdf once downloaded, it shows the full pdf. When I try to use the downloaded pdf to create a new pdf, it’s only printing the first page of the downloaded pdf. That page also spans a page break.
How do I get the full pdf to display in the new pdf and how do I prevent it breaking across new pages?

The reason I am trying to do this is to add signature images to the current pdf and save it as a new pdf to be archived.

const [fetchedPdfUri, setFetchedPdfUri] = useState(route.params?.uri);
const [newPdfUri, setNewPdfUri] = useState(route.params?.uri);
const receiverSignature = route.params?.receiverSignature;

const createPdf = async (html) => {
try {
const { uri } = await Print.printToFileAsync({ html });
setNewPdfUri(uri);
return uri;
} catch (err) {
console.error(err);
}
};

useEffect(() => {
(async () => {
if (receiverSignature && fetchedPdfUri) {
let fileName = ‘original.pdf’;
let fileUri = FileSystem.documentDirectory + fileName;
await FileSystem.downloadAsync(
fetchedPdfUri,
fileUri
);
let base64Pdf = await FileSystem.readAsStringAsync(fileUri, { encoding: ‘base64’ });
const { base64 } = await ImageManipulator.manipulateAsync(
receiverSignature.uri,
,
{ format: ‘png’, base64: true }
);
await createPdf(‘

Test PDF

’);
}
})();
}, [receiverSignature, fetchedPdfUri]);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.