Hi.
I want to find a specific text in the PDF Viewer, scroll automatically to that location, and zoom in. If you support suitable functions, I would appreciate it if you could give me an example.
Thank you :)
|
function SearchTextZoom() {
var viewer = document.getElementById('pdfviewer1').ej2_instances[0];
viewer.textSearchModule.searchText('Resources', false);
viewer.magnificationModule.zoomTo(125);
}
|
Thank you for your answer.
I tried to implement the function by applying the code you told me, but the "zoomIn" code that magnifies the location of the searched text does not seem to work properly. Zoom in to the wrong location without moving to the location of the retrieved text.
Hi TaeWook,
Currently, we don’t have support to zoom in to the particular text location. However, we are exposing an API called ZoomToRect(Rect zoomRect) which helps to zoom into the specified area by passing the bounds of the text. We will check further on this and update the details on April 13, 2022.
Regards,
Vasugi.
Hi TaeWook,
Currently, we are working on this to achieve your requirement. We will check further on this and update the details on April 18, 2022.
Regards,
Vasugi.
Hi TaeWook,
On further analysis, we found that we cannot zoom in to a specific text location using the zoomToRect(Rect zoomRect) method. The zoomToRect(Rect zoomRect) method zooms only a specific area of the annotations, shapes, and form fields present in the PDF document. Please refer to the below code snippet and custom package.
Code Snippet:
|
Var bounds = viewer.annotationCollection[0].bounds; Var pageNumber = viewer.annotationCollection[0].pageNumber; var pagePoint = { x: bounds.left, y: bounds.top }; var clientPoint = viewer.convertPagePointToClientPoint(pagePoint, parseInt(pageNumber) + 1); var rectangle = new DOMRect(clientPoint.x, clientPoint.y, bounds.width, bounds.height); viewer.zoomToRect(rectangle);
|
Custom Package:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/dist1184660880.zip
Kindly try this and let us know if this suits your requirement.
Regards,
Vasugi.
Thank you for your answer.
But I still haven't solved the problem.
1. First of all, the function I want is still to find the location of a specific 'text'. Can I look forward to future support? (I want to zoom in to the location of Text, not Annotations.)
2. I used 'http://cdn.syncfusion.com/ej2/20.1.50/dist/ej2.min.js' and 'https://cdn.syncfusion.com/ej2/20.1.50/material.css' to apply the code you responded to, but the message window keeps showing that the website is unresponsive.
3. Annotations that exist in the PDF file where I am looking for Annotations are not included in 'viewer.annotationCollection'.
I tried to attach the PDF file used for the test by applying the code you answered, but it was not uploaded, so I will send it by email. Please reply after checking.
Hi TaeWook,
|
Query |
Response |
|
1. First of all, the function I want is still to find the location of a specific 'text'. Can I look forward to future support? (I want to zoom in to the location of Text, not Annotations.) |
We have already logged a feature request to Improve the zooming functionality in PDF Viewer and have no immediate plans to implement this. It will be available in any of our upcoming releases. We will consider Zoom to the search text bounds while implementing the feature. You can track the status of the feature through the following link.
Feedback: https://www.syncfusion.com/feedback/34405/improve-the-zooming-functionality-in-pdf-viewer |
|
2. I used 'http://cdn.syncfusion.com/ej2/20.1.50/dist/ej2.min.js' and 'https://cdn.syncfusion.com/ej2/20.1.50/material.css' to apply the code you responded to, but the message window keeps showing that the website is unresponsive. |
We are not getting such unresponsive messages when the latest CDN links are used. The sample we used to check the issue can be downloaded from the following link.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/GettingStarted_Core1744791820
Kindly share the modified sample and a video that shows the issue replication steps to reproduce the issue at our end for further investigation. |
|
3. Annotations that exist in the PDF file where I am looking for Annotations are not included in 'viewer.annotationCollection'. |
Annotations that exist in the shared file are included in the ‘viewer.annotationCollection’. Please refer to the below screenshot.
|
Regards,
Shamini
Hi.
First, we confirmed that the 'No Answer' message window is not caused by the CDN link. But at some point, a message window pops up, and I'm not solving it. I would appreciate your advice on this.
And I also confirmed that the Annotations of the PDF I sent you are included in the 'viewer.annotation Collection'. After that, I used the code you told me before to implement the desired function. However, another problem has arisen.
I sent you an email because the video was not attached, so please check it.
As you can see from the video, when you first click on the search icon, it was enlarged by finding the desired text, but from the second time, you cannot find the desired text. Later, I re-search the text that I was initially looking for, but unlike the first time, I zoomed in to an unfamiliar location.
lastly, anotation's fill color was specified in the location to be enlarged using
DashViewer.annotationCollection[i].fillColor = '#a9d08e';
DashViewer.annotationCollection[i].opacity = 40;
but there is no response.
I will send you some of my sources, test videos, and PDF files by mail. I would appreciate it if you could reply after checking.
From: 김현재 <[email protected]>
Sent: Wednesday, April 27, 2022 2:56 AM
To: Syncfusion Support <[email protected]>
Subject: 'How do I zoom in on a specific location in the PDF
viewer?Related Information for Additional Inquiries about '
<ejs-pdfviewer id="DashPdfViewer" serviceUrl="/api/Viewer" created="pdfLoad" enableTextSearch="true" height="650px"
toolbarSettings="@(new Syncfusion.EJ2.PdfViewer.PdfViewerToolbarSettings { ShowTooltip = true, ToolbarItems = "SearchOption, MagnificationTool, PanTool, SelectionTool, PageNavigationTool" })">
</ejs-pdfviewer>
<ejs-accordion id="defaultAccordion" expandMode="Single" clicked="DashAccordionClicked" expanded="DashAccordionExpanded">
<e-accordion-accordionitems>
<e-accordion-accordionitem expanded="true" header="#HeaderTemplateVV" content="#Content_VV"></e-accordion-accordionitem>
<e-accordion-accordionitem header="#HeaderTemplateHV" content="#Content_HV"></e-accordion-accordionitem>
<e-accordion-accordionitem header="#HeaderTemplateHE" content="#Content_HE"></e-accordion-accordionitem>
<e-accordion-accordionitem header="#HeaderTemplateAP" content="#Content_AP"></e-accordion-accordionitem>
<e-accordion-accordionitem header="#HeaderTemplateSS" content="#Content_SS"></e-accordion-accordionitem>
</e-accordion-accordionitems>
</ejs-accordion>
<div id="Content_VV" style="display:none; width:auto; height:auto;">
<div class="row" style="height:200px;">
<div class="col">
<ejs-accumulationchart id="Chart_VV" enableAnimation="false" pointRender="pointRender">
<e-accumulation-series-collection>
<e-accumulation-series dataSource="@ViewBag.ChartVV" xName="xValue" yName="yValue" name="Vertical Vessel" startAngle="0" endAngle="360" innerRadius="70%">
<e-accumulationseries-datalabel visible="true" name="text" position="Outside">
<e-font fontWeight="700"></e-font>
</e-accumulationseries-datalabel>
</e-accumulation-series>
</e-accumulation-series-collection>
<e-accumulationchart-accumulationannotations>
<e-accumulationchart-accumulationannotation Content="<div style='padding: 5px 5px 5px 5px; font-weight: 1000;'>Total: @ViewBag.TotalVV</div>" X="54%" Y="52%" CoordinateUnits='@Syncfusion.EJ2.Charts.Units.Pixel' region='@Syncfusion.EJ2.Charts.Regions.Series'></e-accumulationchart-accumulationannotation>
</e-accumulationchart-accumulationannotations>
<e-accumulationchart-legendsettings visible="false"></e-accumulationchart-legendsettings>
<e-accumulationchart-tooltipsettings enable="false"></e-accumulationchart-tooltipsettings>
</ejs-accumulationchart>
</div>
</div>
<div class="row" style="height:380px;">
<div class="col" style="align-content:start;">
<ejs-grid id="Grid_VV" gridLines="Both" allowTextWrap="true" rowHeight="25" created="DataBinding" height="300" toolbar="@(new List<string>() { "Search" })" allowSelection="false">
<e-grid-searchsettings fields="@(new string[] { "ITEM" })"></e-grid-searchsettings>
<e-grid-filterSettings type="Excel"></e-grid-filterSettings>
<e-grid-textwrapsettings wrapMode="Header"></e-grid-textwrapsettings>
<e-grid-columns>
<e-grid-column textAlign="Center" width="13" template="#StateTemplate"></e-grid-column>
<e-grid-column field="ITEM" headerText="Item No." textAlign="Center" width="80"></e-grid-column>
<e-grid-column headerText="Search" textAlign="Center" width="70" template="#SearchTemplate"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div>
</div>
</div>
<script id="SearchTemplate" type="text/x-template">
<span id="${ITEM}" title="${DATA_CHECK}" onclick="SearchIconClick(this)" class="btn btn-mini e-icons e-search"></span>
</script>
function SearchIconClick(item) {
var DashViewer = document.getElementById('DashPdfViewer').ej2_instances[0];
DashViewer.magnificationModule.fitToWidth();
var searchText = item.id;
var count;
for (var i = 0; i < DashViewer.annotationCollection.length; i++) {
//if (DashViewer.annotationCollection[i].note.search(item.id) != -1) {
if (DashViewer.annotationCollection[i].note == searchText) {
count = i;
DashViewer.annotationCollection[i].fillColor = '#a9d08e';
DashViewer.annotationCollection[i].opacity = 40;
break;
}
}
var bounds = DashViewer.annotationCollection[count].bounds;
var pageNumber = DashViewer.annotationCollection[count].pageNumber;
var pagePoint = { x: bounds.left, y: bounds.top };
var clientPoint = DashViewer.convertPagePointToClientPoint(pagePoint, parseInt(pageNumber) + 1);
var rectangle = new DOMRect(clientPoint.x, clientPoint.y, bounds.width, bounds.height);
DashViewer.zoomToRect(rectangle);
}
Hi TaeWook,
Please find the details.
|
Query |
Details |
|
|
First, we confirmed that the 'No Answer' message window is not caused by the CDN link. But at some point, a message window pops up, and I'm not solving it. I would appreciate your advice on this.
|
We were unable to replicate the reported issue on our end. Could you please share the replication steps to reproduce the issue and a screenshot of the issue? This will be helpful to investigate further and provide the solution at the earliest. |
|
|
And I also confirmed that the Annotations of the PDF I sent you are included in the 'viewer.annotation Collection'. After that, I used the code you told me before to implement the desired function. However, another problem has arisen.
I sent you an email because the video was not attached, so please check it.
As you can see from the video, when you first click on the search icon, it was enlarged by finding the desired text, but from the second time, you cannot find the desired text. Later, I re-search the text that I was initially looking for, but unlike the first time, I zoomed in to an unfamiliar location.
|
We were able to reproduce the reported issue with the provided details. We will analyze further on this and update you with more details on May 2, 2022.
|
|
|
lastly, anotation's fill color was specified in the location to be enlarged using
DashViewer.annotationCollection[i].fillColor = '#a9d08e'; Copy
but there is no response.
|
We suggest you use the editAnnotation() method to reflect the annotation properties. Please refer to the below code snippet.
|
Regards,
Vasugi.
Hi TaeWook,
Please find the details.
|
Query |
Details |
|
And I also confirmed that the Annotations of the PDF I sent you are included in the 'viewer.annotation Collection'. After that, I used the code you told me before to implement the desired function. However, another problem has arisen.
I sent you an email because the video was not attached, so please check it.
As you can see from the video, when you first click on the search icon, it was enlarged by finding the desired text, but from the second time, you cannot find the desired text. Later, I re-search the text that I was initially looking for, but unlike the first time, I zoomed in to an unfamiliar location.
|
Currently, we are checking the reported issue with the provided details. We will check further on this and update the details on May 4, 2022. |
Regards,
Vasugi.
Hi TaeWook,
We have confirmed that the reported issue is a defect and logged the defect report for the same. The fix for this issue will be included in our upcoming weekly NuGet release on May 25, 2022. You can track the status using the below feedback link.
Regards,
Vasugi.
Hi TaeWook,
Sorry for the inconvenience. The fix was not included in our latest weekly NuGet release. However, we will include the fix in our upcoming weekly NuGet release without further delay on June 8, 2022.
Regards,
Shamini
Sorry for the inconvenience. The fix was not included in our latest weekly NuGet release. However, we will include the fix in our upcoming weekly NuGet release without further delay on June 15, 2022.
Regards,
Shamini
Hi TaeWook,
We have fixed the reported issue and the fix for the reported issue was included in our latest weekly release v20.1.0.60. Kindly upgrade to that version to get the issue resolved.
Packages:
CDN: http://cdn.syncfusion.com/ej2/20.1.60/dist/ej2.min.js
https://cdn.syncfusion.com/ej2/20.1.60/material.css
Regards,
Vasugi.
Hi
I tested it again after updating the package, but it still doesn't work properly. I am attaching the test video and the source again, so please check it.
The test in the video was conducted with Annotation.pdf.
This is my second inquiry. The 'Page No Answer' message that I inquired about earlier only occurs when a specific PDF file is loaded. Loading 'Text.pdf' into the viewer of that page is fine, but loading 'Annotation.pdf' into the viewer of the same page generates a 'Page No Answer' message. The difference between the two files is whether the text is 'annotated'. Please check this part as well.
Hi TaeWook,
Currently, we are checking on the reported issue with the provided details. We will check further on this and update the details on June 21, 2022.
Regards,
Vasugi.
Hi TaeWook,
Please find the details.
|
Query |
Details |
|
I tested it again after updating the package, but it still doesn't work properly. I am attaching the test video and the source again, so please check it. The test in the video was conducted with Annotation.pdf.
|
Sorry for the inconvenience. We were able to reproduce the issue reported issue with the provided details. We will check further on this and update the details on or before June 23, 2022. |
|
This is my second inquiry. The 'Page No Answer' message that I inquired about earlier only occurs when a specific PDF file is loaded. Loading 'Text.pdf' into the viewer of that page is fine, but loading 'Annotation.pdf' into the viewer of the same page generates a 'Page No Answer' message. The difference between the two files is whether the text is 'annotated'. Please check this part as well.
|
We were unable to reproduce the reported issue on our end. We have shared the video for your reference which can be downloaded from the below link.
Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Document-1740528971
Kindly try this and revert to us with the replication video to replicate the reported issue on our end. This will be helpful to investigate further and provide the solution at the earliest.
|
Regards,
Vasugi.
Hi TaeWook,
Please find the details.
|
Query |
Details |
|
I tested it again after updating the package, but it still doesn't work properly. I am attaching the test video and the source again, so please check it. The test in the video was conducted with Annotation.pdf.
|
On further analysis, currently, we can only zoom the particular position that is visible in the viewport. However, we have logged this as a defect, and it will be included in our upcoming weekly release on July 13, 2022. Now, you can track the status using the below feedback link. |
Regards,
Vasugi.
Hi TaeWook,
Sorry for the inconvenience. The fix for the reported issue was not included in our latest release. However, it will be included in our upcoming weekly release on July 27, 2022.
Regards,
CCM Karthik
Hi TaeWook,
Sorry for the inconvenience. The fix was not included in our latest weekly NuGet release. However, we will include the fix in our upcoming weekly NuGet release on Aug 3, 2022.
Regards,
CCM Karthik
Hi Taewook,
Sorry for the inconvenience. We don’t have weekly release for this week. However, it will be included in our upcoming weekly release on Aug 17, 2022.
Regards,
CCM Karthik
Hi Taewook,
Sorry for the delay in resolving the zooming issue. We have fixed it now and shared the custom package for your reference. Kindly test your scenarios and let us know if the fix resolved your issue.
Custom Package - https://www.syncfusion.com/downloads/support/directtrac/general/ze/package1735308419.zip
Regards,
Visvesvar K V
Thank you for your answer.
But I don't know how to apply the custom package you sent to my project.
It may be troublesome, but I would appreciate it if you could tell me how to apply the custom package.
Hi Taewook,
Sorry for the inconvenience. We have shared a package now that is applicable for ASP.NET Core. Kindly use this custom package to resolve the issue. This fix will be available in our upcoming weekly NuGet release on Aug 17, 2022.
Custom Package :
https://www.syncfusion.com/downloads/support/directtrac/general/ze/dist952341957.zip
NOTE: This fix resolves the free text searching in the document instead of the view port.
Regards,
CCM Karthik
Hi Taewook,
We have fixed the reported issue and the fix for the reported issue was included in our latest weekly release v20.2.44. Kindly upgrade to that version to get the issue resolved.
Packages:
CDN Links:
https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js
https://cdn.syncfusion.com/ej2/20.2.44/material.css
Regards,
CCM Karthik
Thank you for your answer.
However, none of the problems in February that I inquired about for the first time have been supplemented.
I updated the NuGet package you mentioned and applied stylesheet and js file, but the search function is not perfect.
In the attached compressed file, there is a video containing my code and problem phenomenon, and a PDF file used in the video.
If you look at the video, only "731-PR-01" can't be found properly and the highlights can't be processed.
It works with the same code, but why can't I search only certain words?
And the text that is normally found also has the highlights too long vertically. I'd appreciate it if you could give me a solution to this, too.
I'm upset that I haven't solved it for too long. Please let me know if there's anything I'm missing.
If possible, I would appreciate it if you could share the test results after conducting the test with the code and PDF file I gave you.
Thank you always for your help. I'll be waiting for the reply.
Hi Taewook,
We were able to reproduce the reported issue “Text highlights cannot be found properly and the highlights are vertically long” and suspect this to be a defect. We will analyze further on this and update you with more details on August 25, 2022.
NOTE: Previously, we have fixed for “Zoom to specific annotation is not visible in the view port” and now we have logged a validation task for another issue, in text search. If the issue is confirmed, we want to follow up in a ticket and will send those details to you here. As it is a different issue, we have to consider it as a separate task. It will be better to follow up in a new ticket and to use this forum to follow up regarding the zoom to issue and the free text search alone.
Regards,
Visvesvar K V
Hi Taewook,
We have created a ticket for this issue "Text highlights cannot be found properly and the highlights are vertically long" under your account. Please follow that for further updates.
Regards,
Padmini
Hello.
“Zoom to specific annotation is not visible in the view port”
I would like to know if the inquiry about "Zoom to specific annunciation is not visible in the view port" has been updated and resolved.
The problem with this matter has not been solved yet, so please give us an answer to solve it.
Regards.
Hi Taewook,
We have created a ticket for this issue "Text highlights cannot be found properly, and the highlights are vertically long" under your account. Please follow the ticket.
Regards,
Anitha