We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

doc.GetObjectById issue

In the example i was given earlier i set the id of a table and try to get it in code by doc.GetObjectById and its always null… the documentation and code samples dont cover this and in the earlier versions this alwasy worked…

Did something change?

@momar

Would you kindly share the sample XML file along with sample code snippet. We will test the scenario in our environment and address it accordingly. Also, please share in which version the things were working for you.

the version we used is the latest version , we took temp license for one month

Below is the sample code

var dataDir = @“C:\Users\OGhani\Downloads”;

        string inXml = dataDir + "input2.xml";
        string inFile = dataDir + "0.png";
        string outFile = dataDir + "output_out.pdf";
        Document doc = new Document();
        doc.BindXml(inXml);

        var assignedToUser = (TextSegment)doc.GetObjectById("AssignedToUser"); 
        assignedToUser.Text = "omar test";

XML sample below

<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="Aspose.Pdf" xml:space="preserve" TabStopPosition="36" IsCoreFontUsed="false" FontSize="10" IsRTLSegmentMode="true" FontName="Times New Roman" IsUnicode="true" IsRightToLeft="true" IsSpaced="true">
  
  <JavaScript ID="js1">this.print(true);</JavaScript>
  
  <Page IsNewPage="true" PageSize="A4" PageMarginLeft="25" PageMarginRight="25">
    
    <Header MarginTop="30" MarginBottom="20"> 
      <Table ColumnWidths="25% 50% 25%"> 
        <DefaultCellBorder><All LineWidth="0.0" /></DefaultCellBorder> 
        <Border><All LineWidth="0" /></Border> 
        <Row> 
          <!-- Header Left -->
          <Cell VerticalAlignment="Bottom" Alignment="Left"> 

 					<TextFragment>

 						<TextSegment Id="FromTxt">FromTxt</TextSegment>

 					</TextFragment>
            <TextFragment><TextSegment FontSize="5"><!--Small Spacer--></TextSegment></TextFragment>
            <TextFragment>
              <TextSegment Id="Date" >Date</TextSegment>
              <TextSegment Id="HeaderSearchReportDateTxt" >HeaderSearchReportDateTxt</TextSegment>
			    

            </TextFragment>
          </Cell>
          <!-- /Header Left -->
        
          <!-- Header Center -->
          <Cell>
		
            <Image FixHeight="70" Alignment="Center" Id="LogoImage" File="../images/ReportLogo.png" Type="png" />
			  <TextFragment>
            <TextFragment><TextSegment><!-- Med Spacer--></TextSegment></TextFragment>
			<TextFragment><TextSegment Id="Title" >Title</TextSegment></TextFragment>
			</TextFragment>
		            
          </Cell> 
          <!-- /Header Center -->
        
          <!-- Header Right -->
          	<Cell VerticalAlignment="Bottom" Alignment="Center"> 
			
              <TextFragment><TextSegment Id="CountryName" 	>CountryName</TextSegment></TextFragment>
              <TextFragment><TextSegment FontSize="5"><!--Small Spacer--></TextSegment></TextFragment>
              <TextFragment><TextSegment Id="ClientName" >ClientName</TextSegment></TextFragment>
              <TextFragment><TextSegment FontSize="5"><!--Small Spacer--></TextSegment></TextFragment>
              <TextFragment><TextSegment Id="DepartmentName" >DepartmentName</TextSegment></TextFragment>
              <TextFragment><TextSegment FontSize="5" Id="DepartmentNameSpacer">DepartmentNameSpacer<!--Small Spacer--></TextSegment></TextFragment>
              <TextFragment><TextSegment Id="CityName" >CityName</TextSegment></TextFragment>           
			           
      		</Cell> 
      </Row>
      </Table> 
  <Table ColumnWidths="25% 50% 25%"> 
        <DefaultCellBorder><All LineWidth="0.0" /></DefaultCellBorder> 
        <Border><All LineWidth="0" /></Border> 
        <Row> 
          <!-- Header Left -->
          <Cell VerticalAlignment="Bottom" Alignment="Left"> 
 
		<TextFragment><TextSegment Id="AssignedToUser" 	>AssignedToUser</TextSegment></TextFragment>
       
          </Cell>
         
      </Row>
      </Table>         

      
    </Header>
    
    <!-- Body -->
  
 			
    <Table ColumnWidths="100%" MarginBottom="15" Id="BodyHeader"
           DefaultCellPaddingTop="3" DefaultCellPaddingBottom="3"
           DefaultCellPaddingRight="3" DefaultCellPaddingLeft="3"
           IsFirstParagraph="true" FontSize="12"> 
      <DefaultCellBorder><All LineWidth="0.0"></All></DefaultCellBorder> 
      <Border><All LineWidth="0.0"></All></Border> 
      <Row>
        <Cell VerticalAlignment="Center" Alignment="Right">
          <TextFragment>
            <TextSegment><!-- BuildBodyHeader method will fill that --></TextSegment>
          </TextFragment>
        </Cell>
      </Row>
      <Row>
        <Cell VerticalAlignment="Center" Alignment="Right">
          <TextFragment>
            <TextSegment><!-- BuildBodyHeader method will fill that --></TextSegment>
          </TextFragment>
        </Cell>
      </Row>
    </Table>
    
 
    
    
    <Table Id="BodyTable" ColumnWidths="20% 10% 20% 10% 10% 10% 16% 6%" MarginTop="20" MarginBottom="20" DefaultCellPaddingTop="3" DefaultCellPaddingBottom="3" DefaultCellPaddingRight="3" DefaultCellPaddingLeft="3"> 
      <DefaultCellBorder><All LineWidth="0.1" /></DefaultCellBorder> 
      <Border><All LineWidth="0.1" /></Border> 
      <Row BackgroundColor="Silver">  
        
          <Cell VerticalAlignment="Center" Alignment="Center"> 
            <TextFragment>
              <TextSegment Id="description" >description</TextSegment>
            </TextFragment>
      	</Cell>
  		<Cell VerticalAlignment="Center" Alignment="Center"> 
            <TextFragment>
              <TextSegment Id="Status" >Status</TextSegment>
            </TextFragment>
        </Cell>
        
        		<Cell VerticalAlignment="Center" Alignment="Center"> 
            <TextFragment>
              <TextSegment Id="DeadLine" >DeadLine</TextSegment>
            </TextFragment>
        </Cell>
        
        <Cell VerticalAlignment="Center" Alignment="Center"> 
          <TextFragment>
            <TextSegment Id="PageNo" >PageNo</TextSegment>
          </TextFragment>
        </Cell>
        
        
             	<Cell VerticalAlignment="Center" Alignment="Center"> 
            <TextFragment>
              <TextSegment Id="LinkedWith" >LinkedWith</TextSegment>
            </TextFragment>
        </Cell>
        
        	<Cell VerticalAlignment="Center" Alignment="Center"> 
            <TextFragment>
              <TextSegment Id="Type" >Type</TextSegment>
            </TextFragment>
        </Cell>
           
 	
 		<Cell VerticalAlignment="Center" Alignment="Center"> 
            <TextFragment>
              <TextSegment Id="TaskTitle" >TaskTitle</TextSegment>
            </TextFragment>
        </Cell>

           <Cell VerticalAlignment="Center" Alignment="Center"> 
            <TextFragment>
              <TextSegment Id="TaskSequence" >TaskSequence</TextSegment>
            </TextFragment>
        </Cell>
      </Row>
    </Table>
    
    <Footer DistanceFromEdge="40" MarginTop="30">
      <Table Id="Footer" ColumnWidths="20% 25% 30%" DefaultCellPaddingBottom="5"> 
      <DefaultCellBorder><All LineWidth="0.0" /></DefaultCellBorder> 
      <Border><All LineWidth="0" /></Border> 
      <Row> 
        <Cell VerticalAlignment="Bottom" Alignment="Right"> 
          <TextFragment>
            <TextSegment Id="PageNumber" >PageNumber</TextSegment>
          </TextFragment>
        </Cell>
        <Cell VerticalAlignment="Bottom" Alignment="Right"> 
          <TextFragment>
            <TextSegment Id="DateAndTime" >DateAndTime</TextSegment>
          </TextFragment>
        </Cell>
        <Cell VerticalAlignment="Bottom" Alignment="Right"> 
          <TextFragment>
            <TextSegment Id="PrintedBy" >PrintedBy</TextSegment>
          </TextFragment>
        </Cell>
      </Row>
      <Row>
          <Cell VerticalAlignment="Bottom" Alignment="Right"><TextFragment><TextSegment ></TextSegment></TextFragment></Cell>
          <Cell VerticalAlignment="Bottom" Alignment="Right"> 
            <TextFragment>
              <TextSegment Id="DateTxt" >DateTxt</TextSegment>
            </TextFragment>
          </Cell>
          <Cell VerticalAlignment="Bottom" Alignment="Right"> 
            <TextFragment>
              <TextSegment Id="PrintedByTxt" >PrintedByTxt</TextSegment>
            </TextFragment>
          </Cell>
        </Row>
    </Table>
    </Footer>
    
 </Page>
</Document>

@momar

We have noticed the similar issue in our environment and sadly, it seems a bug in the API. We have logged an issue as PDFNET-48667 in our issue tracking system for the sake of correction. We will further work over resolving it and keep you informed with the status of its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Dear @asad.ali,

Any update related to the PDFNET-48667 ticket ?

@alterawiwork

We regret to share that previously logged ticket is still pending for a review. Please note that it will definitely be investigated and resolved on first come first serve basis. We will inform you as soon as we have some certain news about its correction. Please give us some time.

We are sorry for the inconvenience.

Dear @asad.ali,

Please note that we are planning to buy license from aspose to use it in our application , and this issue is a showstopper for us , we are looking to have your full support to close this issue ASAP

can you please tell me when this issue will be solved

Regards,

@momar

We have escalated the issue priority to next level while considering your concerns. We will surely let you know about the ETA as soon as the ticket is fully investigated. We request for your patience. Please give us some time.

Immediately following renewal our Aspose.Words and Aspose.PDF licenses we integrated the .lic files with our code base and discovered this show-stopping crtical bug in Aspose.PDF that we’d like an update on - when will a fix be released? Please expedite a response as soon as possible so we can decide how to move forward.

@mfisc

We have recorded your concerns and would like to share that the ticket is under the phase of investigation. We will surely try to complete the investigation as soon as possible and share the fix ETA with you in this forum thread. Please spare us some time.

We apologize for the inconvenience.

Thank you for the reply but the ticket has supposedly been under investigation since August 2020. Please prioritize the investigation so we can make an informed decision, which may include applying for a refund if we don’t receive a reply in a timely fashion.

Thanks for your understanding.

@mfisc

We do understand your concerns and have already escalated the issue priority to the next level. Please note that the issues logged under free support model cannot be expedited to the highest priority as this level is reserved for the issues reported in paid support model. That is why we recommend posting the urgent or showstopper issues in our priority support forum.

Nevertheless, we will definitely try to complete the investigation as soon as possible and come up with some fix ETA. We will soon share updates with you. Your patience and comprehension is highly appreciated in this regard.

We apologize for the inconvenience.

1 Like

Hello, has your team been able to complete the investigation and commit to a fix/timeline?

Thanks for your assistance.

@mfisc

We are investigating the ticket and we expect to complete the investigation this week or in the start of next week. We will further let you know about fix ETA as soon as the investigation is complete. We apologize for the inconvenience.

1 Like

The issues you have found earlier (filed as PDFNET-48667) have been fixed in Aspose.PDF for .NET 22.3.