Sample code for 30+ languages & platforms
Classic ASP Requires Chilkat v11.7.0+

Exclude Rotated Margin Text from PDF Extraction

See more PDF Text Extraction Examples

Demonstrates the "rotatedText" filter. Text that is not aligned with the page, such as a vertical "CONFIDENTIAL" label in the margin, is included by default (after the upright text) and flagged in the quality report; "exclude" leaves it out.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

'  This example requires the Chilkat API to have been previously unlocked.
'  See Global Unlock Sample for sample code.

'  The PDF used in this example is available at rotated_margin.pdf

set pdf = Server.CreateObject("Chilkat.Pdf")
success = pdf.LoadFile("qa_data/pdf/rotated_margin.pdf")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( pdf.LastErrorText) & "</pre>"
    Response.End
End If

set json = Server.CreateObject("Chilkat.JsonObject")
set jsonOut = Server.CreateObject("Chilkat.JsonObject")

'  The page has a paragraph and, rotated 90 degrees along the left margin, "CONFIDENTIAL - DRAFT - NOT FOR DISTRIBUTION".
success = pdf.ExtractText("text",json,jsonOut)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( pdf.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "---- default (rotated text included) ----") & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( jsonOut.StringOf("text")) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( "issue: " & jsonOut.StringOf("quality.pages[0].issues[0].code")) & "</pre>"

success = json.UpdateString("rotatedText","exclude")
success = pdf.ExtractText("text",json,jsonOut)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( pdf.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "---- rotatedText: exclude ----") & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( jsonOut.StringOf("text")) & "</pre>"

'  Sample output:

'  ---- default (rotated text included) ----
'  Restoration Budget Summary
'  
'  Spending for the season came in slightly under the approved budget, largely because the parapet work took less time than expected. The lens loan carries no fee, but the society is responsible for insurance and for the specialist cleaning.
'  
'  CONFIDENTIAL - DRAFT - NOT FOR DISTRIBUTION
'  issue: rotatedText
'  ---- rotatedText: exclude ----
'  Restoration Budget Summary
'  
'  Spending for the season came in slightly under the approved budget, largely because the parapet work took less time than expected. The lens loan carries no fee, but the society is responsible for insurance and for the specialist cleaning.

%>
</body>
</html>