Sergii Posted August 11, 2021 Share Posted August 11, 2021 Доброго времен суток. Как изменить размер страницы в TUniPDFFrame при отображении документа? Необходимо это сделать не из интерфейса. Link to comment Share on other sites More sharing options...
Sherzod Posted August 11, 2021 Share Posted August 11, 2021 Здравствуйте, Уточните вопрос пожалуйста. Link to comment Share on other sites More sharing options...
Sergii Posted August 12, 2021 Author Share Posted August 12, 2021 Загружается файл в TUniPDFFrame. После чего необходимо дать команду отобразить в масштабе 50% (например). Чтобы получить результат как на скрине. Link to comment Share on other sites More sharing options...
Sherzod Posted August 12, 2021 Share Posted August 12, 2021 53 minutes ago, Sergii said: Загружается файл в TUniPDFFrame. После чего необходимо дать команду отобразить в масштабе 50% (например). Чтобы получить результат как на скрине. Попробуйте такой код: procedure TMainForm.UniPDFFrame1FrameLoaded(Sender: TObject); begin (Sender as TUniPDFFrame).JSInterface.JSCode('Ext.get('#1'.iframe.contentWindow.document.getElementById("scaleSelect")).query("option").forEach(function(el) {'+ ' if (el.value == 0.5) {'+ ' el.selected = true;'+ ' var event = new Event("change");'+ #1'.iframe.contentWindow.document.getElementById("scaleSelect").dispatchEvent(event)'+ ' }'+ '});'); end; Link to comment Share on other sites More sharing options...
Sergii Posted August 12, 2021 Author Share Posted August 12, 2021 не работает Link to comment Share on other sites More sharing options...
Sherzod Posted August 12, 2021 Share Posted August 12, 2021 10 minutes ago, Sergii said: не работает Подробности, пожалуйста. Версия UniGUI? Браузер? Link to comment Share on other sites More sharing options...
Sergii Posted August 18, 2021 Author Share Posted August 18, 2021 Браузер - Chrome Версия 92.0.4515.131 Edge Версия 92.0.902.73 FMSoft_uniGUI_Complete_Professional_1.90.0.1547 PDFSCALE.zip Link to comment Share on other sites More sharing options...
Sherzod Posted August 18, 2021 Share Posted August 18, 2021 Я посмотрю Ваш тестовый случай. Link to comment Share on other sites More sharing options...
Sherzod Posted August 18, 2021 Share Posted August 18, 2021 14 minutes ago, Sergii said: Браузер - Chrome Версия 92.0.4515.131 Edge Версия 92.0.902.73 FMSoft_uniGUI_Complete_Professional_1.90.0.1547 PDFSCALE.zip 7.76 MB · 0 downloads Попробуйте с "defer" тогда: procedure TMainForm.UniPDFFrame1FrameLoaded(Sender: TObject); begin (Sender as TUniPDFFrame).JSInterface.JSCode('Ext.defer(function(){Ext.get('#1'.iframe.contentWindow.document.getElementById("scaleSelect")).query("option").forEach(function(el) {'+ ' if (el.value == 0.5) {'+ ' el.selected = true;'+ ' var event = new Event("change");'+ #1'.iframe.contentWindow.document.getElementById("scaleSelect").dispatchEvent(event)'+ ' }'+ '})}, 10);'); end; Link to comment Share on other sites More sharing options...
Sergii Posted August 19, 2021 Author Share Posted August 19, 2021 Нашел закономерность. На onFrameLoaded отрабатывается код и размер выставляется. После того как файл загружен: - после первой загрузки выставляет размер "Автоматически" - после следующей загрузки этого же файла - ранее выбранный размер. Такое впечатление, что есть afterLoaded и в хеше сохраняется размер для файла. Если код повесить на кнопку - размер выставляется корректно. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now