Open Mitia99 opened 1 month ago
Hmm that is a limitation of URLs they have a defined https:// working length, Best I can see is currently around 1500 characters.
@kjk is SumatraPDF limiting by a working buffer length ? I cannot see where a value is garnered for variables WCHAR buf[ INTERNET_MAX_URL_LENGTH + 16]{}; // +16 jic https://github.com/sumatrapdfreader/sumatrapdf/blob/3a708482bfaed25e21656829eb6529824f8aea8f/src/SumatraPDF.cpp#L4663
In theory perhaps 8000 but in practice much less and tainted by add-ons such as %20 for one space character.
Extremely long URLs are usually a mistake. URLs over 2,000 characters will not work in the most popular web browsers. Don't use them if you intend your site to work for the majority of Internet users. from http://stackoverflow.com/questions/417142/ddg#417184
So that method of send a string, is length limited by Windows shell and its current Browser, even if Google allows 5000 by pasting.
Google Translate can work with uploaded documents but SumatraPDF cannot upload files in that fashion.
Potential solutions ?
SumatraPDF currently can export a page number to any external application / "shim" such as a CMD file. Then that CMD file can extract page or text or whole file to send to a Google API via curl.
However that shell customisation is outside of a normal Viewer/Readers remit.
What would help is if the selected text were sent to an external command file.
SumatraPDF version
Describe the bug Translate with Google not working with this file when selecting all text on page 1. Character count limit isn't exceeded though.
To Reproduce Steps to reproduce the behavior:
Nothing happens
Expected behavior Open web browser and translate text
File that reproduces the problem 5000_character_paragraph.pdf
Additional context Browser : Microsoft Edge latest stable version
Thanks for investigating,