Welcome to Microsoft Q&A Forum, thank you for posting your query here!
The Azure Document Translator API does not currently support skipping specific pages during translation. The API translates entire documents without the ability to exclude particular sections or page 1 and takes a blob URL for source and destination.
However, you can manually remove or exclude the addresses from the first two pages before submitting the document for translation. This way, you can ensure that only the desired content is translated.
Here is an example to read a pdf file and save content from page 2 onwards only.
from PyPDF2 import PdfFileReader, PdfFileWriter
input_file = 'example.pdf'
output_file = 'example-updated.pdf'
# Create a PdfFileReader object
reader = PdfFileReader(input_file)
# Create a PdfFileWriter object
writer = PdfFileWriter()
# Loop through the pages and add pages starting from the third page
for page_num in range(2, reader.getNumPages()):
writer.addPage(reader.getPage(page_num))
# Write the output PDF
with open(output_file, 'wb') as output_pdf:
writer.write(output_pdf)
print(f"Output PDF '{output_file}' created with pages starting from the third page.")
Output pdfs can be uploaded to blob storage for document translation using AZ copy command from local directory.upload-a-file
Kindly refer below documentation: document-translation-sdk
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful.
Thank You.